Forgot Password / Register
Site Statistics
Total Members: 520
Total Tutorials: 242
Newsest User: 8884244477
Todays Unique Hits: 190
0 Users 2 Guests Online

Input forms + Dhtml

Okay there are lots of stuff you can use DHtml for. But ill show you it with input forms. Firstly we will begin with clearing forms with dhtml.

This is my simple input text form.
Code

<form action="" method=post>
<input type=text name=username value="Username here">
</form>


This is my form with dhtml onclick command.
Code

<form action="" method=post>
<input type=text name=username value="Username here" onclick="this.value='';">
</form>

This will basically set the text of the field to nothing.

This is my submit button.
Code

<form action="" method=post>
<input type=submit name=login value="Login">
</form>


This is my submit button with dhtml onclick feature again.
Code

<form action="" method=post>
<input type=submit name=login value="Login" onclick="this.value='Submitting...';">
</form>

The above code wll change the text of the submit button to Submitting...

There are lots of different dhtml commands such as:-
onkeydown
onkeypress
onmouseover
onclick
onfocus

Dhtml can also be used to run javascript and is extremely useful for ajax. Also here is a dhtml code that is not recommended in submit buttons...

Code

<form action="" method=post>
<input type=submit name=login value="Login" onclick="this.disabled='1';">
</form>

If this code is used, then the forms action will not be used. Its basically like pressing the stop button when you try logging in.

Thanks, thats all for now. If you have any questions then please ask
ilyas-shezad
Views:
1983
Rating:
There are currently no comments for this tutorial.