0
我想驗證使用Javascript的單選按鈕。但我無法得到它。任何人都可以幫我解決這個問題。我在下面附上我的代碼。謝謝。單選按鈕驗證ü
<form action="submitAd.php" method="POST" enctype="multipart/form-data" name="packages" onsubmit="return checkForm()">
<div id="plans_pay">
<input type="radio" name="group1" id="r1" value="Office" onchange="click_Pay_Office()" style="float:left;margin-top:20px;font-size:72px;">
<label style="float:left; margin-top:20px;" for="pay_office">At Our Office</label>
<img style="float:left;margin-bottom:10px;" src="images/Pay-at-office.png" />
</div>
<div id="plans_pay">
<input style="float:left;margin-top:20px;font-size:72px;" type="radio" name="group1" id="r2" value="HNB" onchange="click_Pay_Hnb()">
<label style="float:left; margin-top:20px;" for="pay_hnb">At Any HNB Branch</label>
<img style="float:left;margin-bottom:10px;" src="images/HNB.png" />
</div>
</form>
的Javascript
function checkForm(){
if(document.packages.pso.checked == false && document.packages.pso1.checked == false && document.packages.ph.checked == false && document.packages.ph2.checked == false && document.packages.ph3.checked == false && document.packages.pl.checked == false && document.packages.p3.checked == false && document.packages.p4.checked == false && document.packages.p5.checked == false && document.packages.p6.checked == false){
alert('Please Select At Least One Package');
return false;
}
if( document.packages.pso.checked == false && document.packages.pso1.checked == false && document.packages.ph.checked == false && document.packages.ph.checked == false && document.packages.ph2.checked == false && document.packages.ph3.checked == false && document.packages.pl.checked == false && document.packages.p3.checked == false && document.packages.p4.checked == false && document.packages.p5.checked == false && document.packages.p6.checked == false){
alert('Please Select At Least One with the Advertise online option in premium package');
return false;
}
if(document.getElementById('words').value==''){
alert("Please Enter the Texts");
return false;
}
if(document.getElementById('r1').checked==false && document.getElementById('r2').checked==false){
alert("Please Select a Payment Method");
return false;
}
}
哪裏是pso和pso1? –
我不喜歡在這裏添加整個代碼,它存在於我的代碼中。 –
目前發生了什麼? –