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

Q274 How do I make an image move across the page?

irt.org | Knowledge Base | DHTML | Q274 [ previous next ]

Q274 How do I make an image move across the page?

The following works in Netscape Navigator 4 and Internet Explorer 4:

<div id="x" style="position:absolute; top:0; left:-20;"><img src="dot.gif" width="10" height="10"></div>

<script language="JavaScript"><!--
function moveit() {
    if (document.all) {
        document.all.x.style.posLeft = document.all.x.style.posLeft + 20;
        if (document.all.x.style.posLeft < screen.width)
            setTimeout("moveit()",100);
    }
    else if (document.layers) {
        document.x.left += 20;
        if (document.x.left < screen.width)
            setTimeout("moveit()",100);
    }
}

if (document.all || document.layers)
    moveit();
//--></script>

Provide feedback ...
AddThis Social Bookmark Button

Provide feedback ... AddThis Social Bookmark Button


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