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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using the onkeyup event (or any of

Status
Not open for further replies.

karenmierkalns

Programmer
May 10, 2001
54
CA
Using the onkeyup event (or any of the key events), where is the key that is pressed stored? I need to know which key is pressed...what variable/property is it stored in? In VB its all in the parameters..but with vbscript, it's more difficult to figure this out.

Thanks. - Karen
 
Just check the event properties. Example:
Code:
<HTML>
<HEAD>
<SCRIPT LANGUAGE=VBScript>
Sub txtTest_onkeyup()
  MsgBox &quot;Key: &quot; & CStr(window.event.keyCode)
End Sub
</SCRIPT>
</HEAD>
<BODY>
<INPUT id=txtTest>
</BODY>
</HTML>
The MSDN Library is very useful in answering questions such as this. If you aren't subscribing to the CDs/DVDs there is always the free online version too!


Look for the &quot;Library&quot; link.
 
Thank you so much.

I looked in the MSDN library, but only found the event, not how to use it.

Thanks a lot! - Karen
 
Sometimes you DO have to &quot;do some drilling&quot; before you strike oil in those MSDN Library articles.

I guess I'm just tuned into it right now because I've been thrashing with it a lot the last month.

Happy HTMLling!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top