Home Articles FAQs XREF Games Software Instant Books About Feedback Search Site-Map
irt.org logo

Q726 How can I disable a graphic button on page before the page is fully loaded and enable the button once the entire page has loaded?

irt.org | Knowledge Base | JavaScript | Image | Q726 [ previous next ]

Q726 How can I disable a graphic button on page before the page is fully loaded and enable the button once the entire page has loaded?

Use the typical image swapping techniques - but the default image to be displayed should be blank, and the image "swap" should be triggered by the onLoad event handler:

<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript"><!--
if (document.images) {
    nonblank = new Image();
    nonblank.src  = 'nonblank.gif';
}

function swap() {
    if (document.images)
        document.images['myImage'].src = nonblank.src;
}
//--></SCRIPT>
</HEAD>

<BODY onLoad="swap()">

<IMG NAME="myImage" SRC="blank.gif" WIDTH="100" HEIGHT="100">

</BODY>
</HTML>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


Last Updated: 30th March 2008. Maintained by: Martin Webb and Michel Plungjan
irt.org liability, trademark, document use, privacy statement and software licensing rules apply.
Copyright © 1996-2008 irt.org, All Rights Reserved.