Lodius2000 Posted June 20, 2008 Share Posted June 20, 2008 so the question is easy, i have a feeling the answer may not be so much regarding forms, some websites, like google for example have their search field active, so that all you must do is type google.com in your address bar, press enter and start typing your search query, where like this site, when you click new topic, one would think that subject would be the active field, allowing you to start typing the title of your post, but it is not, forcing the user to click the field or tab to it, how do you make a field active like google, or countless other sites do Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/111039-solved-easy-one-regarding-forms/ Share on other sites More sharing options...
whizard Posted June 20, 2008 Share Posted June 20, 2008 javascript: <script language="JavaScript"> <!-- document.the_form.u_input.focus(); //--> </script> HTH Dan Quote Link to comment https://forums.phpfreaks.com/topic/111039-solved-easy-one-regarding-forms/#findComment-569803 Share on other sites More sharing options...
realjumper Posted June 20, 2008 Share Posted June 20, 2008 With JavaScript.... <script language="JavaScript"> document.form_name.text_area_name.focus(); </script> Quote Link to comment https://forums.phpfreaks.com/topic/111039-solved-easy-one-regarding-forms/#findComment-569804 Share on other sites More sharing options...
Lodius2000 Posted June 20, 2008 Author Share Posted June 20, 2008 so the doccument is called index.php form name is register field name is username index.php.register.username.focus(); or index.register.username.focus(); also where in index.php does this script go, in the head right //i know NOTHING about javascript thanks Quote Link to comment https://forums.phpfreaks.com/topic/111039-solved-easy-one-regarding-forms/#findComment-569812 Share on other sites More sharing options...
whizard Posted June 20, 2008 Share Posted June 20, 2008 index.register.username.focus(); should be document.register.username.focus(); document is a keyword. since theres only one document, it automatically assumes its the current file. This goes in the body, wherever. (with the <script> tags around it, obviosly) HTH Dan Quote Link to comment https://forums.phpfreaks.com/topic/111039-solved-easy-one-regarding-forms/#findComment-569813 Share on other sites More sharing options...
Lodius2000 Posted June 20, 2008 Author Share Posted June 20, 2008 k thanks, that makes sense EDIT: quick note, I determined, at least in my document that the js needs to go after the form so that the form name and field name are defined, so the js is near the end of my document, but it does work beautifully Quote Link to comment https://forums.phpfreaks.com/topic/111039-solved-easy-one-regarding-forms/#findComment-569818 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.