Thanks Michael, but that doesn't work either...it's like my script can't
detect any account elements except the first one. I've been trying to get
access to the information for other scripts and can't...the only thing I can
do is collect the information after the page has been submitted.
I use the follow script to create text boxes when a person wants to add an
function addacc(num) {
var del1 = document.getElementById(num)
var stuff;
var arow = num * (-1);
document.RFO.arow.value=arow;
document.all.AccAmt.style.visibility="visible";
document.all.AccTot.style.visibility="visible";
document.RFO.acc_tot_1.value="Balance";
document.RFO.acc_tot_1.disabled="true";
stuff = "<table><tr><td width=\"70\"><input type=\"text\" size=\"5\"
name=\"fund_" + arow + "\" class=\"regSoft\">"
stuff = stuff + "</td><td width=\"70\"><input type=\"text\" size=\"5\"
name=\"org_" + arow + "\" class=\"regSoft\">"
stuff = stuff + "</td><td width=\"70\"><input type=\"text\" size=\"5\"
name=\"program_" + arow + "\" class=\"regSoft\">"
stuff = stuff + "</td><td width=\"50\"><input type=\"text\" size=\"2\"
name=\"activity_" + arow + "\" class=\"regSoft\">"
stuff = stuff + "</td><td width=\"70\">"
stuff = stuff + "<input name=\"acc_tot_" + arow + "\" type=\"text\"
class=\"regSoft\" size=\"5\">"
stuff = stuff + "</td></tr></table>"
num = num - 1;
stuff = stuff + "<div id=\"" + num + "\" style=\"visibilty:visible\">"
stuff = stuff + "<A onClick=\"javascript
:addacc(" + num +")\"><u
class=\"regSoft\"><font color=\"blue\">Add Account</font></u></a></div>"
del1.innerHTML = stuff
}
Michael Winter <M.******@blueyonder.co.invalid> writes:
On Fri, 23 Jan 2004 09:57:13 -0600, <ab*******@hotmail.com> wrote:
for(i = document.RFO.arow.value; i > 1 ; i--){
if (document.RFO.acct_tot_i.value ==""){
alert("Need Amount For Each Account Used");
document.RFO.acct_tot_i.focus();
}
}
The problem seems to be with the if statement...I've also tried
if (document.RFO.acct_tot_(i).value ==""){
alert("Need Amount For Each Account Used");
document.RFO.acct_tot_(i).focus();
}
Try:
if( '' == document.forms['RFO'].elements['acct_tot_' + i].value ) {
alert( 'Need amount for each account used.' );
document.forms['RFO'].elements['acct_tot_' + i].focus();
}
The 'if' expression could also be written
if( !document.forms['RFO'].elements['acct_tot_' + i].value ) {
Mike