--- trunk2/out/js/iframe.js 2004/11/01 22:13:41 577 +++ trunk2/out/js/iframe.js 2004/11/01 22:15:20 578 @@ -29,31 +29,57 @@ if (doc.body) { var h = -1; + var h1 = -1; if (doc.body.scrollHeight) { - h = parseInt(doc.body.scrollHeight) || -1; + h1 = parseInt(doc.body.scrollHeight) || -1; + //alert(name+" scrollHeight "+h1); + if (h1 > h) h = h1; } - if (h < 0 && doc.body.clientHeight) { - h = parseInt(doc.body.clientHeight) || -1; + if (doc.body.clientHeight) { + h1 = parseInt(doc.body.clientHeight) || -1; + //alert(name+" clientHeight "+h1); + if (h1 > h) h = h1; } - return h; +/* + var elm = document.getElementById(name); + if (elm) { + elm.style.height = 'auto'; + h1 = elm.offsetHeight; + alert(name+" offsetHeight "+h1); + if (h1 > h) h = h1; + } +*/ + + return h + 20; } return 50; } function iframe_resize(name) { - if (! iframe_id(name).src) return; - iframe_id(name).style.height = String(iframe_height(name)+'px'); + var el=iframe_id(name); + + if (! el || ! el.src) return; + + el.style.height = String(iframe_height(name)+'px'); } function iframe_load(name,url) { if (! name || ! url) return false; - iframe_id(name).src = url; + var el=iframe_id(name); + + if (! el) alert("can't find element "+name); + + // is there src, and is src same? + if (el.src && el.src.substr(el.src.length - url.length) == url) return false; + + el.style.height = '0px'; + el.src = url; return false; }