mar_zim
Sep 14th, 2004, 12:58 AM
hi to everyone im very new in this thing.
why this code wont work?
whats wrong w/ it?
what i want to achieve is when i hit the enter key it will get focus to another textbox..
<form>
<input type="textbox" name="textbox1" onkeypress="keydown(event)" >
<input type="textbox" name="textbox2">
</form>
<script>
function keydown(e){
if (!e) var e = window.event;
if (e.keyCode) code = e.keyCode;
else if (e.which) code = e.which;
if (code==13){
textbox2.focus();
}
}
</script>
thanks in advance guys..
more power ;)
why this code wont work?
whats wrong w/ it?
what i want to achieve is when i hit the enter key it will get focus to another textbox..
<form>
<input type="textbox" name="textbox1" onkeypress="keydown(event)" >
<input type="textbox" name="textbox2">
</form>
<script>
function keydown(e){
if (!e) var e = window.event;
if (e.keyCode) code = e.keyCode;
else if (e.which) code = e.which;
if (code==13){
textbox2.focus();
}
}
</script>
thanks in advance guys..
more power ;)