Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Prevent Double-clicking

Status
Not open for further replies.

arundahar

Programmer
Apr 27, 2001
53
GB
Hi i need some Javascript that prevents double-clicking a "submit" button on a User registration/login page.
I have this code :

if(dF.Get(f.name) != false)
{
alert("In progress...")
return;
}

where f = FormName

But it doesn't work, you double-click and it brings up the "In progress..." alert. When you click the "ok" button nothing happens, the form is not submitted...

Any ideas?

Cheers

Arun
 
<SCRIPT language=javascript>
var i = 0
function myfunc() {
//myform.submit();
i++;
alert(i);
}
</script>
<form name=myform action=&quot;test.asp&quot;>
<input type=button value=&quot; ok &quot; id=submit1 name=submit1 onclick=&quot;this.disabled=-1;myfunc();&quot;>
</form>
 
cheers, but i use an <a href=&quot;javascript:submitForm()&quot;><img></a> to submit my form rather that an <input type=&quot;submit&quot;>

How would i use that code with this sort of submitting?

I've tried a combination of things but just get &quot;Object expected&quot; errors..

Cheers
 
try this

<imput type=&quot;image&quot; src=&quot;myimage.gif&quot; border=&quot;0&quot;>

this acts just like a submit button but has an image instead

hope this helps

rob
 
nope none of the above works, just get an &quot;Object Expected&quot; error...
 
You can disable an image as well like so:
<script>
var i = 0;
function myfunction() {
// document.location=&quot;somewhere you want to navigate to.htm&quot;;
i++
alert(i);
}
</script>

<img src=myimg width=500 height=500 name=myimg id=myimg onclick=&quot;myimg.disabled=true;myfunction();&quot;>
 
Of cource the line
document.location=&quot;somewhere you want to navigate to.htm&quot;;
should be:
myform.submit();
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top