www.webdeveloper.com
Results 1 to 2 of 2

Thread: Right-To-Left moving Image Script

  1. #1
    Join Date
    Jun 2005
    Posts
    1

    Right-To-Left moving Image Script

    The script below moves an image from left to right.

    I wish to rewrite it to:
    1) move the image from RIGHT to LEFT
    2) Create a series of 6 images and after the 6th image the 1st image comes back up
    3) Also the image moves at the bottom of the body and NOT at bottom of page

    Do let me know how this can be done

    Thanks a lot
    ---------------------------------------------------------------


    <html>
    <body>
    <script language="VBScript">
    on error resume next
    if parent.navButtonStatus <> 3 then
    if err.number <> 0 then
    call parent.ThereIsAnError
    end if
    end if
    </script>
    <script language="JavaScript">


    var yend;
    var ystart;
    var ydiff;
    var xincrement;
    var yincrement;
    var screenwidth;
    var screenheight;

    function Ypick(){

    if (!document.all)
    return
    screenwidth = screensize.offsetWidth;
    screenheight = screensize.offsetHeight;
    xincrement = (screenwidth/10);
    ystart = Math.round(screenheight-92);
    yend = Math.round(screenheight-92);
    document.all.ball.style.top=ystart;
    document.all.ball.style.left=-100;
    if (ystart > yend){
    ydiff = (ystart-yend);
    yincrement = (ydiff/xincrement);
    Moveneg();
    }
    else {
    ydiff = (yend-ystart);
    yincrement = (ydiff/xincrement);
    Movepos();
    }
    }
    function Moveneg(){
    if (screenwidth > parseInt(document.all.ball.style.left)) {
    with (document.all.ball) {
    style.left = parseInt(style.pixelLeft + 3);
    style.top = parseInt(style.pixelTop - yincrement);
    }
    setTimeout('Moveneg()',20);
    }
    else {
    with (document.all.ball) {
    style.left = parseInt(style.pixelLeft - screenwidth);
    style.top = parseInt(style.pixelTop - yend);
    }
    Ypick();
    }
    }
    function Movepos(){
    if (screenwidth > parseInt(document.all.ball.style.left)) {
    with (document.all.ball) {
    style.left = parseInt(style.pixelLeft + 3);
    style.top = parseInt(style.pixelTop + yincrement);
    }
    setTimeout('Movepos()',20);
    }
    else {
    with (document.all.ball) {
    style.left = parseInt(style.pixelLeft - screenwidth);
    style.top = parseInt(style.pixelTop - yend);
    }
    Ypick();
    }
    }
    </script>
    <div id="screensize" style="position: absolute; top: 0; left: 0; height: 100%; width: 100%"></div>
    <p><img id="ball" SRC="http://dynamicdrive.com/plane.gif" style="container:in-flow;position:relative;left:-100;top:0;visibility:show">

    <body onload="Ypick()">
    </body>
    </html>

  2. #2
    Join Date
    Jun 2005
    Location
    Norfolk, VA, USA
    Posts
    61
    You might want to move this to the JavaScript Forum.

    maffmommie nqztiv
    I'm new to the game.


    Aw well...Another four years without a President.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles