Solved
javascript focus
Posted on 2000-03-23
Hey all,
Need some help with this.. I would really appreciate any help in this pls..
I have a small javascript
<script language="JavaScript1.2">
if (document.layers)
document.captureEvents(Event.KEYPRESS)
function alert_keycode(){
alert(event.keyCode)
}
document.onkeypress=alert_keycode
</script>
<HEAD>
<form>
<P>INPUT: <INPUT type="button" value = "Check "></P>
<P><input type="text"></P>
</form>
</HTML>
I am using IE 4.0
What I need to do is ---
I want to check in my javascript
if(event.keyCode == 65) (means if we press "a")
I want to change my focus from may be button --- to a Text Field..
so that key "a" works in the same way as "TAB" key ..
I don't want to loop through the elements in the form.. because I will be using the same script in many pages and all pages have different number of elements..
Is there anything like advanceFocus in javascript which can just advance my focus to next element on the page..
I guess browser already knows which element has got a focus .. May be I can use some of that information but I don't know how..
I would really appreciate any help with this..
Best Regards