日期:2014-05-17 浏览次数:20864 次
<script>
function beforesubmit()
{
if (document.getElementById("FixYN").value="N")
//if (document.form1.FixYN.value ="N" )
{
if (document.form1.BBPre.value!="")
{
var len1 = document.form1.BBPre.value.length //获取判定碼值的長度
var BBPre1 = document.form1.BBPre.value
var beginno1 = document.form1.beginno.value //獲取beginno的值
var beginno2 = (beginno1.substr(0,len1))
if (BBPre1 != beginno2)
{
alert("首碼與判定碼不對應!")
form1.beginno.focus();
return false;
}
}
}
}
</script>
<form id="form1" name="form1" method="post" action="" onsubmit="return beforesubmit()">
<p>
<label for="BBPre"></label>
<input name="BBPre" type="text" id="BBPre" value="ABCD" />
Y
:
<input type="radio" name="FixYN" id="FixYN" value="Y" />
N:
<label for="FixYN"></label>
<input type="radio" name="FixYN" id="FixYN" value="N" />
<label for="FixYN"></label>
</p>
<p>
<label for="beginno"></label>
<input type="text" name="beginno" id="beginno" />
</p>
<p>
<input type="submit" name="button" id="button" value="提交" />
</p>
</form>
<script>
function beforesubmit()
{
if (document.getElementById("FixY").checked)
//if (document.form1.FixYN.value ="N" )
{
if (document.form1.BBPre.value!="")
{
var len1 = document.form1.BBPre.value.length //获取判定碼值的長度
var BBPre1 = document.form1.BBPre.value
var beginno1 = document.form1.beginno.value //獲取beginno的值
var beginno2 = (beginno1.substr(0,len1))
if (BBPre1 != beginno2)
{
alert("首碼與判定碼不對應!")
form1.beginno.focus();
return false;
}
}
}
}
</script>
<form id="form1" name="form1" method="post" action="" onsubmit="return beforesubmit()">
<p>
<label for="BBPre"></label>
<input name="BBPre" type="text" id="BBPre" value="ABCD" />
Y
:
<input type="radio" name="FixYN" id="FixY" value="Y" />
N:
<label for="FixYN"></label>
<input type="radio" name="FixYN" id="FixN" value="N" />
<label for="FixYN"></label>
</p>
<p>
<label for="beginno"></label>
<input type="text" name="beginno" id="beginno" />
</p>
<p>
<input type="submit" name="button" id="button" value="提交" />
</p>
</form>