PDA

Click to See Complete Forum and Search --> : moving objects


merhaba
Sep 15th, 2002, 03:24 AM
:eek: 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

Doe maar
Sep 16th, 2002, 07:03 AM
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>