Results 1 to 3 of 3

Thread: I'm sorry for the noob question

  1. #1
    Join Date
    Jul 2005
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default moving pictures to form an animation to the mouseX

    <html>
    <head>
    <script>
    //sorry for sloppy script just testing
    movecounter = 0;
    function move1(){
    playerxspeed=8;
    playeryspeed=8;
    oveTox=event.clientX;
    oveToy=100;
    you1.style.posLeft +=playerxspeed;
    you1.style.posTop +=playeryspeed;
    movetimer = setTimeout("move1();",60);
    movecounter += 1;
    tempc = movecounter*playerxspeed;
    if(tempc >= oveTox){
    clearTimeout(movetimer);
    }
    }
    </script>
    </head>
    <body>
    <table width="800" height="800">
    <tr>
    <td onclick="move1()">
    <IMG id="you1" SRC="you.bmp" STYLE="position: absolute; z-index:3">
    </td>
    </tr>
    </table>
    </body>
    </html>
    this is my script I think the problem may be in the oveTox variable does it store as a string I dunno I just actually started coding again sorry for stupid question.
    Last edited by Willdawg; 07-19-2005 at 02:09 AM. Reason: I love life

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Events are handled differently in IE and Mozilla. This one works in IE6:
    Code:
    <html>
    <head>
    <script>
    //sorry for sloppy script just testing 
    movecounter = 0;
    function move1(e){
    playerxspeed=3;
    playeryspeed=3;
    oveTox=e;
    oveToy=600;
    document.getElementById('you1').style.posLeft +=playerxspeed;
    document.getElementById('you1').style.posTop +=playeryspeed;
    movetimer = setTimeout("move1();",60);
    movecounter += 1;
    tempc = movecounter*playerxspeed;
    if(tempc >= oveToy){
    clearTimeout(movetimer);
    }
    }
    </script>
    </head>
    <body>
    <table width="800" height="800">
    <tr>
    <td onclick="move1(event.clientX)">
    <IMG id="you1" SRC="some.jpg" STYLE="position: absolute; z-index:3">
    </td>
    </tr>
    </table>
    </body>
    </html>
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Jul 2005
    Posts
    28
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thanks for the help, as I said before I just started programming again and forget some of the less known commands.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •