Onload does not work in div elements

hi gurus,

I have an onload handler that worked fine if applied in <body onload=“getCountries()” >, but did not work in <div onload=“getCountries()” >. I searched for a while in the forum and got no clue. How to solve this? I need to put it in <div> elements.

Thanks a lot.
Charlie

Either stick that code in the body onload, or place it in a script tag just below the div, like
<div></div>
<script>getCountries();</script>

hi buddy
there is no “onload” function for div tag
so, if u want to execute the content of <div></div>
first write <div></div> and its content and after that
call the getCountries() function inside the <script></script> tag

i hope this will help you
if u have any query plz post

Hi wysiwyg & Steve, thanks, that fixed my problem.

I have this line:
<script src=“my7.js” language=“JavaScript” type=“text/javascript”>
in the html head, can I put it in a PHP function and echo this line and use the javscript as if it is in the html head?
Thanks,
Charlie

Hi Charlie

what you are telling is fine, you can proceed