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

Q1357 Why is there a delay in swapping images that I have already preloaded?

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

Do not specify the image dimensions. Change:

<script language="JavaScript"><!--
if (document.images) {
    name1on = new Image(100,100);
    name1on.src = 'name1on.gif';
    name1off = new Image(100,100);
    name1off.src = 'name1off.gif';
}
//--></script>

with:

<script language="JavaScript"><!--
if (document.images) {
    name1on = new Image();
    name1on.src = 'name1on.gif';
    name1off = new Image();
    name1off.src = 'name1off.gif';
}
//--></script>

Feedback on 'Q1357 Why is there a delay in swapping images that I have already preloaded?'

©2018 Martin Webb