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 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 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> 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 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 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 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
Archived
This topic is now archived and is closed to further replies.