/[webpac]/trunk2/out/js/iframe.js
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Contents of /trunk2/out/js/iframe.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 575 - (show annotations)
Mon Nov 1 18:00:26 2004 UTC (19 years, 5 months ago) by dpavlin
File MIME type: application/javascript
File size: 1173 byte(s)
first iframe implementation of tree, shuffled a bit paramters to
WebPAC::Tree (so, node dir is now parametar to new and not to output)

1 // load iframe and resize it
2 // written by Dobrica Pavlinusic <dpavlin@rot13.org>
3 // based on great hints from Robert Avilov
4
5 var iframe_id_cache = Array();
6
7 function iframe_id(name) {
8 if (! iframe_id_cache[name]) {
9 iframe_id_cache[name] = self.document.getElementById(name);
10 }
11 return iframe_id_cache[name];
12 }
13
14
15 function iframe_doc(name) {
16 if (iframe_id(name).contentDocument) return iframe_id(name).contentDocument;
17 if (iframe_id(name).contentWindow) {
18 try {
19 return iframe_id(name).contentWindow.document;
20 } catch (e) {};
21 }
22 if (iframe_id(name).document) return iframe_id(name).document;
23 return null;
24 }
25
26 function iframe_height(name) {
27
28 var doc = iframe_doc(name);
29
30 if (doc.body) {
31 var h = -1;
32
33 if (doc.body.scrollHeight) {
34 h = parseInt(doc.body.scrollHeight) || -1;
35 }
36 if (h < 0 && doc.body.clientHeight) {
37 h = parseInt(doc.body.clientHeight) || -1;
38 }
39
40 return h;
41
42 }
43 return 50;
44 }
45
46 function iframe_resize(name) {
47 if (! iframe_id(name).src) return;
48
49 iframe_id(name).style.height = String(iframe_height(name)+'px');
50 }
51
52 function iframe_load(name,url) {
53
54 if (! name || ! url) return false;
55
56 iframe_id(name).src = url;
57
58 return false;
59 }
60

  ViewVC Help
Powered by ViewVC 1.1.26