[thelist] [OT]: body onload hack

billybad billybad at belgacom.net
Thu Apr 25 08:58:00 CDT 2002


<tip type="javascript" title="body onload hack" author="Marin Gatellier">
<SCRIPT LANGUAGE="JavaScript" TYPE="text/javascript">
<!--
// to be place at the bottom of a page when the <body> tag is uneditable
//(i.e. when it's in an include)
// it will take what exists in the onload and add your custom function
//(here: WhenReadyPage())

x=(typeof(window.onload)!='function')?function(){;}:window.onload;
window.onload=function(){x();WhenReadyPage()}

//-->
</SCRIPT>
</tip>

can be used to add a function to the onload event of a html page
it's a sort of new bodyonload = previous bodyonload + myownfunction

Can be very usefull when you have an include of the <body > tag

Marin





More information about the thelist mailing list