keystroke Posted April 17, 2009 Share Posted April 17, 2009 You know when you login to a website, lets say face book for example. When you get to the site you do not need to click in the username field. You can just start typing your username in right away, without using your mouse to click where you want to type. I want this implemented into my site, just not sure how to go about it. I have tried searching google many times with no luck as of yet. Link to comment https://forums.phpfreaks.com/topic/154454-question-about-a-login/ Share on other sites More sharing options...
Andy-H Posted April 17, 2009 Share Posted April 17, 2009 This is done using javascript. <script type="text/javascript"> var field1 = document.getElementById('fieldname'); var field2 = document.getElementById('field2name'); function focusLoad(){ if (field1.value.length == 0) { field1.focus(); } else { field2.focus(); } } </script> <body onload="focusLoad();"> That should do the job in most browsers, look on the W3C schools website to look into javascript nd the HTML DOM more. Link to comment https://forums.phpfreaks.com/topic/154454-question-about-a-login/#findComment-812112 Share on other sites More sharing options...
keystroke Posted April 17, 2009 Author Share Posted April 17, 2009 Thanks Andy-H, I am going to try this in the morning and see if I can get it to work. I will post my results. Thanks alot for getting back to me so fast. Link to comment https://forums.phpfreaks.com/topic/154454-question-about-a-login/#findComment-812130 Share on other sites More sharing options...
keystroke Posted April 21, 2009 Author Share Posted April 21, 2009 Didn't work for me, still trying other things here. Link to comment https://forums.phpfreaks.com/topic/154454-question-about-a-login/#findComment-815238 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.