...

View Full Version : Nice continuously loop for submit-button-value: wait. wait.. wait... wait....



ozcar
12-14-2006, 11:53 PM
When submitting a form, disableForm() is started, which disables the submit and reset button, and will change the submit-value to "please wait".

I want that "please wait" changes by time, so:
"please wait."
"please wait.."
"please wait..."
"please wait...."

My javascript debugger says:
Fault: tempobj is not defined.

Do you see the problem? :)
Thanks in advance!



var dots=1;

function disableFormDotDotRun(tempobj) {
if(dots==3) { dots=1; } else { dots++; }
setTimeout('disableFormDotDot(tempobj,dots)',50);
}

function disableFormDotDot(tempobj,dots) {

if(dots==1) { var temp2="."; }
if(dots==2) { var temp2=".."; }
if(dots==3) { var temp2="..."; }

tempobj.value='moment a.u.b.'+temp2;
disableFormDotDotRun(tempobj);
}

function disableForm(theform) {
if(d.all||d.getElementById){
for(i=0;i<theform.length;i++){
var tempobj=theform.elements[i];
if(tempobj.type.toLowerCase()=='submit'||tempobj.type.toLowerCase()=='reset') {
tempobj.disabled = true;
disableFormDotDotRun(tempobj);
}
}return true;
}
}

ozcar
12-15-2006, 12:16 AM
Okay, thanks to some friends..

I had to define the var tempobj before the functions, and now it works.
Thanks!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum