Results 1 to 2 of 2

Thread: moving objects

  1. #1

    Thread Starter
    Fanatic Member merhaba's Avatar
    Join Date
    Sep 2002
    Location
    Istanbul,Bartin-Gallipoli(Gelibolu-Canakkale)
    Posts
    601

    Lightbulb moving objects

    hello there..
    The following codes are for moving an image or objects USING ARROWS ON A KEYBOARD IN VISUAL BASIC...

    What I want to learn is how to assign these arrows to move things in JAVASCRÝPT..
    ...ý MEAN I WANT TO MOVE ANY OBJECTS USÝNG ARROWS ON MY KEYBOARD..

    Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
    Select Case KeyCode
    Case vbKeyUp:
    Label1.Top = Label1.Top - 10
    Case vbKeyDown:
    Label1.Top = Label1.Top + 10
    Case vbKeyLeft:
    Label1.Left = Label1.Left - 10
    Case vbKeyRight:
    Label1.Left = Label1.Left + 10
    End Select
    End Sub

    tHANKS

  2. #2
    Addicted Member
    Join Date
    Jul 2002
    Location
    Brussels, Belgium
    Posts
    139
    This is the code to move an object to the right.


    <HTML>
    <HEAD>
    <TITLE></TITLE>
    <SCRIPT LANGUAGE=javascript FOR=document EVENT=onkeydown>
    if (window.event.keyCode==39)
    {
    text1.style.posLeft= text1.style.posLeft + 10
    }
    </SCRIPT>
    </HEAD>
    <BODY>
    <INPUT type="text" style="position:absolute" name=text1 id=text1>
    </BODY>
    </HTML>

Posting Permissions

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



Click Here to Expand Forum to Full Width