|
#1
|
|||
|
|||
|
Hi there. I'm using the code below to execute a javascript function when a correct password is entered into a textbox. It works fine when the button is clicked, but not if users type in the password and then press 'enter'... is there some way I can get this to work?
Code:
<FORM ACTION="#" NAME=verify>
<input id="photos" type=password size=10>
<input type="button" value="click" onclick="javascript:Check()">
</FORM>
<SCRIPT TYPE="TEXT/JAVASCRIPT">
document.verify.photos.focus()
</SCRIPT>
|
|
#2
|
||||
|
||||
|
Code:
<form action="#" name="verify" onsubmit="Check();return false;"> <input id="photos" type="password" size="10"> <input type="submit" value="click"> </form> <script type="text/javascript"> document.forms['verify'].elements['photos'].focus(); </script> Also, you shouldn't include javascript: pseudo-protocol indicators in event handlers.
__________________
Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP! Last edited by Twey; 01-26-2006 at 07:59 PM. |
|
#3
|
|||
|
|||
|
Works like a charm, thanks.
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
|
|