这是我的代码.. 招标 组织注册 标记的游戏是强制性的 登录名 联系人 公司名称* 邮寄地址* 国家 印度 市* 手机号码* 电话号码。 电子邮件ID* 以前的项目* 建立年份* 类型*
<tr>
<td> TERMS & CONDITIONS</td>
<td>
1. Tenderer certifies that to the best of his knowledge the particulars furnished as above by him are true, correct, complete and current in every respect. If any stage it is found that information furnished by Tenderer is untrue, inaccurate, incomplete or not-current, Railway reserves its right to reject Tenderer?s offer or terminate his contract beside taking any other legal course of action as deemed fit. 2. Permitting downloading of tender document by Railway is an added facility for convenience of Tenderer/s. Railway, however, reserves right to extend this facility for selected works or continue only with direct sale of tender forms. In case, tender document is not uploaded on website or download failure or incomplete document downloaded, Railway shall not be responsible in anyway. Railway shall not be responsible for any direct/indirect loss of business/profit resulting from inability to use this facility.<br>
3. Tenderer intends to download and print the tender document solely for the purpose of bidding for above work and downloaded document shall not be used, copied or reproduced for any other purpose.
4。投标人同意在提交报价时以招标公告中规定的格式支付不可退还的招标文件费用。如果他未能以规定的形式提供招标文件的必要费用,他的报价将被拒绝。 6.投标人应自行更新铁路通过报纸,网站或电子邮件或任何其他方式发出的招标公告和招标文件的任何修改,并采取相应行动。投标?如果他没有附上所有更正/更正以及下载的招标文件,则应拒绝提议。
</td>
</tr>
<tr>
<td> </td>
<td>
<form name="terms" action="#" method="post">
<input type= "radio" name = "term"> Agree
<input type = "radio" name = "term"> Disagree
</form>
</td>
</tr>
<tr>
<td> </td>
<td>
<form>
<input type = "submit" value = "Save" onClick=" return save_form()">
<input type = "reset" name = "reset" onClick="reset_form()">
</form>
</td>
</tr>
</table>
<script type= "text/javaScript">
function save_form()
{
var a= document.getElementById("text1").value;
var b= document.getElementById("text2").value;
var c= document.getElementById("text3").value;
var d= document.getElementById("text4").value;
var e= document.getElementById("text5").value;
var f= document.getElementById("text6").value;
var g= document.getElementById("text7").value;
var h= document.getElementById("text8").value;
var i= document.getElementById("text9").value;
var j= document.getElementById("text10").value;
var atpos= g.indexOf("@");
var dotpos= g.lastIndexOf(".");
if (((document.form.term[0].checked==false) && (terms.term[1].checked==true)) || ((terms.term[0].checked==false) && (terms.term[1].checked==false)))
{
alert(" Agree with our agreement for your submission");
return (false);
}
else
{
alert("You are registered");
return(true);
}
}
但单选按钮上的验证无效..请提供可能的解决方案
答案 0 :(得分:1)
布尔表达式不起作用。你做不到:
if((a || b || c ... || j) == null)
OR
的所有值,并将它们与null
进行比较,这不是您想要的。你想要做的是:
if((a == null) || (b == null) ... (j == null)) {
...
}
对a.length
的支票也一样。您不能简单地OR
所有.length
值,然后检查它是否小于或等于一。
答案 1 :(得分:0)
你可以做的是将它们全部放在一个控件中,然后遍历那些Divs子项(这将是你要检查的字段)并以编程方式检查它们的所有值,而不是将每个字段硬编码为{{ 1}}陈述
答案 2 :(得分:0)
使用jQuery轻松验证单选按钮:
<form>
<input type="radio" name="term" id="agree" value="agree"> Agree
<input type="radio" name="term" id="disagree" value="disagree"> Disagree
<form>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.js">
var termChoice;
$(document).ready(function() {
$('input:radio[name="term"].change(function() {
termChoice = $(this).is(':checked').val();
});
});
//have fun with the termChoice variable
</script>
//在纯粹的js中,这可以是例如在被称为
的验证函数中if (document.getElementById('agree').checked) {
//do stuff
}
else if (document.getElementById('disagree').checked) {
//do stuff
}