46 users online (0 members and 46 guests)  


  Results 1 to 2 of 2

Related

  1. Moving elements    Forum: Javascript Forum
    Replies: 4
  2. Moving Site (maybe)    Forum: Graphics Forum
    Replies: 1
  3. help moving linked images    Forum: Myspace Forum
    Replies: 1
  4. Moving Stuff?    Forum: Myspace Forum
    Replies: 0
  5. Moving Text and Images    Forum: CSS Forum
    Replies: 2
  1. #1
    neoserenity's Avatar
    New User

    Status
    Offline
    Join Date
    Apr 2004
    Posts
    5

    Question moving two images across the screen

    Hi,

    Does anyone know how to move two images across the webpage? (I'm guessing this is DHTML)

    Right now, I am able to move one image across the page with the following code in the body section:

    <div id="x" style="position:absolute; top:100; left:0;"><img src="superman.gif"></div>

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

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


    but when I try to add another layer and copy and pasted the script, it didn't work.

    Thanks for any help!

    Best wishes to all

  2. #2
    QuietDean's Avatar
    Administrator

    Status
    Offline
    Join Date
    Oct 2000
    Location
    Bournemouth, UK
    Posts
    2,662
    Copy and paste is okay, but change the function name and the reference to 'x' (I assume this is your image, but without the rest of the code its only a guess).
    If one of our members helps you, please click the icon to add to their reputation!
    No support via email or private message - use the forums!
    Before you ask, have you Searched?



Tags for this Thread