Function SearchField_OnKeyDown()
If window.event.keyCode = 8 Then
If window.event.repeat Or Not Em(document.all("SearchField").value) Then
lBackspaceExits = False
window.clearTimeOut(cBackTimeoutID)
cBackTimeoutID = window.setTimeout("ResetBackspaceExit()", 600)
ElseIf lBackspaceExits Then
window.history.back()
lBackspaceExits = False
End If
ElseIf window.event.keyCode = 13 Or _
window.event.keyCode = 38 Or window.event.keyCode = 40 Or _
window.event.keyCode = 33 Or window.event.keyCode = 34 Then
SearchField_OnKeyDown = document_onkeydown()
Exit Function
End If
SearchField_OnKeyDown = True
End Function
can you explain how to convert above function to javascript ? speacialy I need to know how to convert following steps
window.event.repeat
window.clearTimeOut(cBackTimeoutID)
window.setTimeout("ResetBackspaceExit()", 600)
SearchField_OnKeyDown = document_onkeydown()
event.repeat is not working in javascript. return the undefined
event.repeatindicates, if the key fired the event is pressed continuosly, this is valid JS.window.clearTimeout()is the same in JS, it clears the timeout assigned tocBackTimeoutID.The 3rd line needs a little fix:
JavaScript syntax you can find at MDN.