0

Hi there,,

I am trying to get my hea around this simple line of code and trying also to make it work. The ball doesn't move to any direction.. thanks for the help..

    <script type="text/javascript">

        function moveRight(){

            document.images['ball'].style.left = parseInt(document.images['ball'].style.left)+5 +"px";

        }
    </script>
</head>
<body>


        <img id="ball" src="ball.jpg" alt="ball bouncing" width="50px" height="50px"/> <br/>

        <input type="button" onclick="javascript: var t = setInterval('moveRight()',  10);"  value="move me">

</body>
2
Contributors
1
Reply
3
Views
5 Years
Discussion Span
Last Post by Troy III
0

First
you need to disconnect the "ball" image from the document flow: using absolute positioning.

Edited by Troy III

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.