Javascript window.onload problem
Posted: Wed Nov 23, 2005 10:38 am
Hi All,
First of all I'll state I'm a PHP coder that usually steers clear of javascript, however, I need some help with a problem.
I have a script that needs to execute a javascript function once the page has loaded and before everyone shouts out the following:
or
... there is a problem with the above methods. I have no control over the onload body tag as this script is designed to be included regardless of the what the designer has done for layout. Thus, in this case the designer is already using the onload body attribute to fix some style issues and besides I'd like it t me more independant. For eaxmple:
So my question is, can I manipulate the contents of window.onload and some how append additional events?
First of all I'll state I'm a PHP coder that usually steers clear of javascript, however, I need some help with a problem.
I have a script that needs to execute a javascript function once the page has loaded and before everyone shouts out the following:
Code: Select all
<body onload="myfunction()">Code: Select all
<script>
window.onload= new Function("myfunction()");
</script>Code: Select all
<body onload="FixLayout()">