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

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

You are here: irt.org | FAQ | DHTML | Q274 [ previous next ]

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>

©2018 Martin Webb