Script Categories













Forms >>> Copy Name.

Allows the user to enter their name in the first field and have copies it to the second field for use as the User ID. It occurs instantly when they click the next field or the submit button. And, if the user tries to modify the second field, it is changed back to the value of the name field. Definitely a good example of the onChange() event handler in use.

Name:
User ID:

Add the below code to the <body> section of your page:

<pre>
<form name=userform>
Name:     <input type=text name=name size=15 value="" onChange="this.form.userid.value=this.value;"><br>
User ID:  <input type=text name=userid size=15 value="" onChange="this.value=this.form.name.value;">
<p>
<input type=button name=action value="Done!">
</form>
</pre>


Code was highlighted by 1st JavaScript Editor (The Best JavaScript Editor!).

benaughty dating


©