...

View Full Version : using 2 onload event in the body tag?



ClueLess
01-26-2006, 08:47 PM
Want to know is is possible to have 2 diff. onload events in the same page? I have 2 different scripts for 2 diff. things. They both use onload event.....if so, how can we handle it. Thanks.

luckygirl
01-26-2006, 09:12 PM
It is for images, but once you use the onload event in the body tag it overrides the image tag onload events. I think//

liorean
01-26-2006, 09:18 PM
Given there are no other conflicts between the scripts, you simply write them together. If the originals said onload="xxxxx" and onload="yyyyy" respectively, then you can write them together as onload="xxxxx;yyyyy". A better approach would perhaps be to do it in script though.

arnyinc
01-26-2006, 09:37 PM
I usually just make a new function and have that call my two other functions.

<html>
<head>
<script>
function newFunction(){
xxxx();
yyyy();
}
</script>
</head>

<body onload="newFunction();">
</body>
</html>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum