Da_Stimulator
DEV Team Forum Moderator
    
USA
3373 Posts |
Posted - 02 November 2000 : 22:48:34
|
I saw this @ dynamicdrive.com and figured it would be useful to prevent double posts, when someone clicks on submit, the button is disabled. The script is below. ( http://www.dynamicdrive.com/dynamicindex11/submitonce.htm )
<font color=red>usage:</font id=red><font color=blue><form method="whatever" </font id=blue><font color=green>onSubmit="submitonce(this)"</font id=green><font color=blue>></font id=blue> <script> function submitonce(theform){ //if IE 4+ or NS 6+ if (document.all||document.getElementById){ //screen thru every element in the form, and hunt down "submit" and "reset" for (i=0;i<theform.length;i++){ var tempobj=theform.elements[i] if(tempobj.type.toLowerCase()=="submit"||tempobj.type.toLowerCase()=="reset") //disable em tempobj.disabled=true } } } </script>
<font color=red>Da_Stimulator</font id=red> <font color=red>http://aokingdom.com</font id=red> <font color=blue>response.write("I know what you coded last summer!")</font id=blue>
Edited by - Richard Kinser on 05 January 2001 00:22:24 |
|