Help with Javascript

I have a page with Javascript that is supposed to move a graphic downward when I click a button. However, when I click the button, nothing happens. Can someone help me figure out what I'm doing wrong? Thanks.

Here's my code:

    <html>

    <head>
       <title></title>
       <script type="text/javascript">

          var column = 0;

          function moveArrowDown()
          {     

              document.getElementById("Darrow").style.top=335+(column*12);

              if (column < 20)
                 {
                     column++;
                     window.setTimeout("moveArrowDown();",130);
                 }

          }

       </script>
    </head>

    <body>

       <div align="center">
            <h1><strong>DHTML Down</strong></h1>

             <div id="Darrow" style="position:absolute; left:335px; top:240px; visibility:visible; z-index:2; width: 100px; height: 103px;"><img border="0" src="DArrowS.png" width="95" height="103"></div> 
       </div>

       <form>
           <input type="button" id="sbutton" value="submit" onClick="moveArrowDown();">
       </form>


    </body>
    </html>

Comments

  • buttonmasherbuttonmasher United States

    Never mind; I figured it out. There was some extra code in the <!DOCTYPE html> tag that I got rid of, and apparently, that code needed to be there.

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

In this Discussion