Guest_imported
New member
- Jan 1, 1970
- 0
I am having an issue wherein I have two forms. While normally, if you hit enter, it automatically clicks submit for you (in IE) this does not happen when you have a select box selected... to fix this I created the following script:
<script language = javascript>
function document.onkeydown()
{
if(window.event.keyCode == 13) {
document.form1.submit();
}
}
</script>
Now this works great when there is only one form... however on this page there are two. As a result I want to add if statements to that so that it determines which select box has the focus, then performs the appropriate function... the unfortunate thing is that the select boxes have the exact same name, like so:
<form name="form1">
<select name="select">
</select>
</form>
<form name="form2">
<select name="select">
</select>
</form>
I thought that code like the following would work:
If(form1.select.focus=true){
function
}
However this has not proved fruitful... any ideas? This is targeted specifically at IE, Opera and Netscape are not a concern at this point, however they may be in the future.
<script language = javascript>
function document.onkeydown()
{
if(window.event.keyCode == 13) {
document.form1.submit();
}
}
</script>
Now this works great when there is only one form... however on this page there are two. As a result I want to add if statements to that so that it determines which select box has the focus, then performs the appropriate function... the unfortunate thing is that the select boxes have the exact same name, like so:
<form name="form1">
<select name="select">
</select>
</form>
<form name="form2">
<select name="select">
</select>
</form>
I thought that code like the following would work:
If(form1.select.focus=true){
function
}
However this has not proved fruitful... any ideas? This is targeted specifically at IE, Opera and Netscape are not a concern at this point, however they may be in the future.