...

View Full Version : Are you allowed to call to javascript body onloads on a single page?



bsharif
06-26-2006, 02:31 PM
Hello all ,are you allowed to call to javascript body onloads on a single page?


<body onload="Populate(''VisibleId'',DropBoxArray,''ShowOrHide'')" onLoad="document.UpdateDataRequest.p_target_date.focus()">
:thumbsup:


thanks

bsharif
06-26-2006, 02:32 PM
meant to say 2 (two) instead of "to"

bsharif
06-26-2006, 03:04 PM
I found out the answer by playing with it myself . You have to separate each onload function call that you choose to use with a semicolon.

example:


<body onload="Populate(''VisibleId'',DropBoxArray,''ShowOrHide'');document.UpdateDataRequest.p_target_date.focus()">

Kor
06-26-2006, 03:19 PM
in fact is better to separate content from javascript control codes. The proper way is to place your javascript code in the HEAD of the page, and use onload event there with an anonymous:

<script type="text/javascript">
......functions, code lines, and so on......
onload=function(){
myFunc1(param1,param2);
myFunc2(param3);
... othe statemens, functions, and so on
}
</script>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum