Keydown events

G

Guest

Is there any API which i can use to trap the key press or key down events for
the Internet explorer browser. This is not a windows form, it is a web form.

The method used currently is below.

sScript.Append("<SCRIPT language=""javascript"">" & vbCrLf)
sScript.Append("function fnTrapKD(btn){" & vbCrLf)
sScript.Append(" if (document.all){" & vbCrLf)
sScript.Append(" if (event.keyCode == 113)" & vbCrLf)
sScript.Append(" { " & vbCrLf)
sScript.Append(" event.returnValue=false;" & vbCrLf)
sScript.Append(" event.cancel = true;" & vbCrLf)
sScript.Append(" btn.click();" & vbCrLf)
sScript.Append(" location.href='config.aspx';" & vbCrLf)
sScript.Append(" } " & vbCrLf)
sScript.Append(" if (event.keyCode == 118)" & vbCrLf)
sScript.Append(" { " & vbCrLf)
sScript.Append(" event.returnValue=false;" & vbCrLf)
sScript.Append(" event.cancel = true;" & vbCrLf)
sScript.Append(" btn.click();" & vbCrLf)
sScript.Append(" location.href='editing.aspx';" & vbCrLf)
sScript.Append(" } " & vbCrLf)
sScript.Append(" } " & vbCrLf)
sScript.Append("}" & vbCrLf)
sScript.Append("</SCRIPT>" & vbCrLf)


What i want is, is there a way we get these functions in any API so that a
custom control can be written which does this.

The reason this is needed is, we are forced to code keypress in javascript
client side, and when some validations are to be done before the keypress,
need to code javascript again for this. ? This forces to write javascript for
everything and the validation controls couldn't be used which was provided
with ASP.NET
 
C

Cor Ligthert

Shiva,

In my opinion is when you start using (be able) API's your application is
directly closed for every computer else than a window system.

Just my thought,

Cor
 
G

Guest

Thank you Cor, most users are windows users.
So if this is possible, i would like to try :)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top