If I enter some information in a form and refresh the page the data which was in the form is still in the fields. How can i have it so if i refresh the page the form refreshes (like what the reset button does)
NOTE: I do not want to have a reset button
Below is the code that i have at the moment and i want it to fit in this code:
Any help will be appreciated.
NOTE: I do not want to have a reset button
Below is the code that i have at the moment and i want it to fit in this code:
Code:
<script> //"Accept terms" form submission- By Dynamic Drive //For full source code and more DHTML scripts, visit http://www.dynamicdrive.com //This credit MUST stay intact for use var checkobj function agreesubmit(el){ checkobj=el if (document.all||document.getElementById){ for (i=0;i<checkobj.form.length;i++){ //hunt down submit button var tempobj=checkobj.form.elements[i] if(tempobj.type.toLowerCase()=="submit") tempobj.disabled=!checkobj.checked } } } function defaultagree(el){ if (!document.all&&!document.getElementById){ if (window.checkobj&&checkobj.checked) return true else{ alert("Please read/accept terms to submit form") return false } } } document.forms.agreeform.agreecheck.checked=false </script> <style type="text/css"> label{ float: left; width: 120px; font-weight: bold; } input, textarea{ width: 180px; margin-bottom: 5px; } textarea{ width: 250px; height: 150px; } .boxes{ width: 1em; } #submitbutton{ margin-left: 120px; margin-top: 5px; width: 90px; } br{ clear: left; } </style> <html> <form name="agreeform" onSubmit="return defaultagree(this)"> <label for="firstname">First Name</label> <input type="text" name="firstname" value="" /><br /> <label for="emailaddress">Email Address:</label> <input type="text" name="emailaddress" value="" /><br /> <label for="message">Message</label> <textarea name="message"></textarea><br /> <label for="terms">Agree to Terms?</label> <input name="agreecheck" type="checkbox" name="terms" class="boxes" onClick="agreesubmit(this)"> /><br /> <input type="submit" value="Submit!" disabled name="submitbutton" id="submitbutton" /> </form> </html>
Comment