Page 1 of 1

JavaScript Problems

Posted: Mon 22. Oct 2007, 03:19
by dustin-lee
Hello,

I'm trying to use this JavaScript:

Code: Select all

</head>
<script type="text/javascript">
function autofitIframe(id){ // v.1.0
//copyright 2004 Eddie Traversa http://www.dhtmlnirvana.com/
if (!window.opera && !document.mimeType && document.all && document.getElementById){
parent.document.getElementById(id).style.height=this.document.body.offsetHeight+"px";
}
else if(document.getElementById) {
parent.document.getElementById(id).style.height=this.document.body.scrollHeight+"px"
}
}
</script>

<body onload="autofitIframe('Entrycontainer')">
But it needs to go in between the </head> and <body>.

I've tried using:

Code: Select all

$content['page_start'] .= '  <script src="'.TEMPLATE_PATH.'inc_js/cwf.js" type="text/javascript"></script>'.LF;
But that doesn't work. I've tried using it in the template area but that doesn't work either. And I've also been using body onload="autofitIframe('Entrycontainer') in the JS onload in the templates area.

Does anyone know how I can add this code in between the </head> and <body>?

Any help would be much appreciated!

Posted: Mon 22. Oct 2007, 08:31
by Oliver Georgi
never use body onload anymore!!!

Have a look at template there you can find a field "JS onload".

Otherwise put the JavaScript at bottom of your template near the closing </body> so that it is the last which is loaded when page is rendered. Works almost.

Oliver