Home Articles FAQs XREF Games Software Instant Books BBS About FOLDOC RFCs Feedback Sitemap
irt.Org
#

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?

You are here: irt.org | FAQ | JavaScript | Image | Q726 [ previous next ]

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>

©2018 Martin Webb