javascript simple - reading data from from
Posted: Mon Feb 23, 2009 5:03 am
Hi Experts,
I have an simple form. when I read the value of radio button noting is returned.
When I wrote the value of the radio button it displayed "[object]" in IE 7 and in FF 3 it returned [object NodeList]
Here is the HTML code
Here is the Javascript:
Can any one help me spot the bug? thanks guys
sokka
I have an simple form. when I read the value of radio button noting is returned.
When I wrote the value of the radio button it displayed "[object]" in IE 7 and in FF 3 it returned [object NodeList]
Here is the HTML code
Code: Select all
<form name="screen4form" method="post">
<table border="0" width="400" cellspacing="0" cellpadding="0">
<tr valign="middle">
<td width="16%" class="tblPad5 contentheadingblue"><div align="right"><strong>EITHER</strong></div></td>
<td width="79%" class="tblPad5"><label><input type="radio" name="gateway" value="PayPal" />
Pay Pal (Visa, MC, PayPal a/c)</label></td>
</tr>
<tr valign="middle">
<td align="right"> </td>
<td> </td>
</tr>
<tr valign="middle">
<td class="tblPad5 contentheadingbluelarge"><div align="right"><strong>OR</strong></div></td>
<td class="tblPad5"><label><input type="radio" name="gateway" value="WorldPay" checked/> WorldPay (Visa, MC, AMEX)</label></td>
</tr>
<tr valign="middle">
<td height="19"> </td>
<td> </td>
</tr>
</table>
<a href="#" onclick='contributeNow(this.form)'><img src="../../../images/ContributeNow.jpg" name="lets-do-it" border="0" id="lets-do-it2" /></a></form>Code: Select all
function contributeNow()
{
var joomlaid = "<?=$joomlaid?>";
if (joomlaid == 0 ) {
alert('Please login before continuing. If you have not registered please register now for B1G1 BUSINESS');
}
else{
var txtC;
var textremdays = document.screen4form.selectMonth.value;
var validremdays = validremdays * 1;
var PageName = "3";
if( ( (document.screen4form.ContributionType[0].checked == true) && (textremdays!="") && (textremdays!=0) ) || (document.screen4form.ContributionType[1].checked == true) ){
if(document.screen4form.ContributionType[0].checked == true){
var txtR = document.screen4form.ContributionType[0].value;
var paramString = txtR;
}else if(document.screen4form.ContributionType[1].checked == true){
var txtC = document.screen4form.ContributionType[1].value;
var paramString = txtC;
}
var paramString = paramString+"|"+textremdays+"|"+joomlaid;
alert("paramString"+paramString);
alert("gateway "+document.screen4form.gateway);
// code where the error occurs
[color=#BF0000] if ((document.screen4form.gateway == "WorldPay") || (document.screen4form.gateway == "")){
alert("gateway "+WorldPay);
var urlstr="<?=$this_site_domain?>development/b1g1f/partnership/partnering_ContributionWP_set.php?paramString="+escape(paramString);
window.location=urlstr;
}else if (document.screen4form.gateway == "PayPal"){
alert("gateway "+PayPal);
var urlstr="<?=$this_site_domain?>development/b1g1f/partnership/partnering_Contribution_PP_set.php?paramString="+escape(paramString);
window.location=urlstr;
} [/color]
}
else if( (document.screen4form.ContributionType[0].checked == false) && (document.screen4form.ContributionType[1].checked == false)){
alert('Please select the type of contrubution!');
document.screen4form.ContributionType[0].focus();
}
else if((textremdays==0) || (textremdays=="") || (isNaN(validremdays)) ){
alert('Please Enter a valid reminder month and it must be numerical values');
document.screen4form.selectMonth.focus();
}
}
}
sokka