帮写段js验证 比较变量的值,弹出不同的提示,并使相应的select 聚焦

来源:百度知道 编辑:UC知道 时间:2024/06/28 13:03:14
<SCRIPT LANGUAGE="JavaScript">
<!--

function jiujiu(){

if(document.getelementbyid("zweighrj").value<21000){

if (document.songhuofanshi.value=3 || document.songhuofanshi.value=4 || document.songhuofanshi.value=5){
alert "the total weight belows 21000g ,you cannot choose the TNT ,UPS or DHL,please choose EMS or AIR!";
return false;

}
return true;

}
return true
}

-->
</script>
不懂js
自己随便乱写的
根本没有反应

-------
目的是根据变量zweight的值是否小于21000
如果小于21000在判断select的当前选项
如果两者都合条件就弹出提示,返回FALSE 否则ture

表单:
<form name="shouhuoxx" method="post" action="payment.asp?action=txxx4" onsubmit="javascript:return jiujiu();" >

********
<tr bgcolor="#FFF9E6"> <input id="zweightj" value=<%=requset("zweight"

<form name="shouhuoxx" method="post" action="payment.asp?action=txxx4" >

<input name="zweightj" value='111' type='text' >
<input name="songhuofanshi" value='3' type='text' >

<input type='button' value='提交' onclick=jiujiu(); >
</form>
<script>
function jiujiu(){
var FormBar=document.shouhuoxx;
if(FormBar.zweightj.value<21000){
if (FormBar.songhuofanshi.value=='3' || FormBar.songhuofanshi.value=='4' || FormBar.songhuofanshi.value=='5'){
alert('the total weight belows 21000g ,you cannot choose the TNT ,UPS or DHL,please choose EMS or AIR!');
return false;
}
return true;
}
return true;
}
</script>