Jump to content

Recommended Posts

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

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

 

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

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.