Keydown events

  • Thread starter Thread starter Guest
  • Start date Start date
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
 
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
 
Back
Top