Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

An interesting challenge involving keypress

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I have a webpage with an active x window displaying graphics. I want to use the arrows on the keyboard to call up functions to manipulate it. I have tried ascii with no luck. Any ideas on what I could do..


Thanks in advance!
 
Hello,
See an example:

<SCRIPT LANGUAGE=&quot;vbscript&quot;>
<!--
sub document_onkeydown
charCode = window.event.keyCode
window.status = charCode 'see in status bar what is the ascii code
if (charCode = 37) then msgbox &quot;left arrow&quot; end if
if (charCode = 38) then msgbox &quot;up arrow&quot; end if
if (charCode = 39) then msgbox &quot;right arrow&quot; end if
if (charCode = 40) then msgbox &quot;down arrow&quot; end if
end sub
//-->
</SCRIPT>

 
u have to create some methods or properties of your active x obj and from html script callthem when the arrows keys are pressed (let's say &quot;key&quot;)...
or use the keys from activex control...

from html scripting this is the code
keyup event (after u relese the key)
key code
leftarrow = 37
rightarrow = 39
up = 38
down = 40

keydown event (when u press the key)
key code
leftarrow = 37
rightarrow = 39
up = 38
down = 40


<object .... name=activex id=activex>
<BODY onkeyup=&quot;doKeyU();&quot; onkeydown=&quot;doKeyD()&quot;>
</BODY>
<script language=&quot;javascript&quot;>
function doKeyU()
{
activex.key=window.event.keyCode;
};
function doKeyD()
{
activex.key=window.event.keyCode;
};
</script>

this is a simple example witch may not work... but shows u how to use it
hope this helps..
________

George
 
Thankyou so much. This syntax of both will help me get a better picture. I just started programming in vbs and needed the help.

Thanks....

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top