adding onLoad event handlers to HTML objects?

Need technical advice on coding your web pages? Covers HTML, JavaScript, CSS, and some server side technologies. Also the issue of some webpages not displayed well.

Moderator: Don_HH2K

adding onLoad event handlers to HTML objects?

Postby mlibbybmwl » Sun 07 Nov, 2004 10:35 pm

IE allows adding onload event handlers to certain html objects. The following example shows how this is done for an IMG object. Does mozilla have a comparable method that proivides this same type functionality?

Code: Select all
<SCRIPT>
function imageLoaded(theImg)
{
window.status = "Image " + event.srcElement.src + " is loaded";
// or
window.status = "Image " + theImg.src + " is loaded";
}
</SCRIPT>
<BODY>
<IMG SRC="Images\01.jpg" onload="imageLoaded(this)"> <!-- ONLOAD EVENT ADDED HERE!!!!!! -->
</BODY>


Mike

(BBCode format added by Admin.)
UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
mlibbybmwl
new member
new member
 
Posts: 4
Joined: Sat 06 Nov, 2004 8:44 pm

Return to Web Design and Page Coding

Who is online

Registered users: Google [Bot]