Sandeep's Nook: JavaScript Page

Remember Me Checkbox

This script is for use in forms that require user input; for instance blogs where users have to type their Name and E-mail every time they wish to add their remarks to the blog entries. By adding this script, users will have the option to let their information be remembered so that they would not have to type in their information every time they wish to add their notes. This script uses cookies to store and output the information.

You can check out the script by filling in the form below. After filling in the details and clicking Submit you shall be taken back to the page from where you came to this page. Click the link to this page again. If you did choose the Remember me option, you would see your Name and E-mail already typed in. Users can choose how many days the cookies would last. In the example the cookies would last only for a day. Clicking the Delete Information button would delete the cookies.

Form
Name:   
E-mail:   
Remember me?:   
   

Author: Sandeep Gangadharan
Home Page: http://www.sivamdesign.com/home/


The script is given below:

This goes in the HEAD of the html file:


Note the script in the FORM tag:

<form name="form" action=" " method="post" onSubmit="if (this.checker.checked) toMem(this)">

Remember that the Remember me checkbox should be named checker as shown below:

<input type="checkbox" id="checker" name="checker" />

Shown below is the code for the Delete Information button.

<input type="button" onclick="delMem(this)" value="Delete Information" />

This goes in the BODY of the html file and should be added below the form: