[Javascript] Stop button from firing
Michael Borchers
list at tridemail.de
Thu Jan 31 08:55:40 CST 2008
----- Original Message -----
From: Michael Borchers
To: [JavaScript List]
Sent: Thursday, January 31, 2008 3:52 PM
Subject: [Javascript] Stop button from firing
I have a little script that creates new rows with prototype.
When constantely hitting the executing button some rows share the same index.
How can I make my script wait getting finished before getting fired again?
Thanks
function JSONAddIndexedRow(numRowsIndex, addToElement, JSONUrl, direction) {
if($(numRowsIndex)) {
var numRows = parseInt($F(numRowsIndex));
}
if(JSONUrl != '') {
new Ajax.Request(JSONUrl + '?num_rows=' + numRows,
{
method:'post',
onSuccess: function(JSON) {
if(JSON != null) {
var JSONRows = JSON.responseText;
if(direction == '') {
direction = 'after';
}
if($(numRowsIndex).value = numRows+1) {
if($(addToElement)) {
switch(direction) {
case 'after':
new Insertion.After($(addToElement), JSONRows);
break;
case 'before':
new Insertion.Before($(addToElement), JSONRows);
break;
case 'bottom':
new Insertion.Bottom($(addToElement), JSONRows);
break;
case 'top':
new Insertion.Top($(addToElement), JSONRows);
break;
}
}
}
}
}
}
);
}
}
ok, here is a simple trick so far:)
if($F(numRowsIndex) != numRows+1) {
instead of
if($(numRowsIndex).value = numRows+1) {
any better ideas?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.evolt.org/pipermail/javascript/attachments/20080131/168f660c/attachment.htm>
More information about the Javascript
mailing list