|
-
Sep 24th, 2002, 09:43 AM
#1
Thread Starter
Fanatic Member
help me with the codes
Hello there,
I wanted to move an image or an object accross the page(screen)...but I think I have some problem in getting it work..If anyone can help me with the following codes..iwill be happy...Whats wrong with the codes below...please tell me where to put codes...image..object..because I am new to Javascript language..give me an example that works.......yours
If have to be a specific key to activate the motion, modify this:
PHP:
function MovingObject(ObjectToMove) {
if(document.event.KeyCode == 13) { //This makes the ENTER key activate the motion
ObjectToMove.scrLeft=left;
ObjectToMove.scrTop=top;
setTimeOut(delay,"Moving(ObjectToMove)");
}
}
For other keys you have to figure out the KeyCode.
I can do this way:
PHP:
<HTML><HEAD><SCRIPT language="JavaScript"><!--
function GetKeyCode() {
alert("KeyCode is " + document.event.KeyCode);
}
document.keydown=GetKeyCode();
}
--></SCRIPT></HEAD>
<BODY>
<P> Press the key you want to know the KeyCode
</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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|