js怎么判断画面上输入两个数字的大小?金额必须比下达资金大如果输入的下达资金大有警告提示
<divclass="editorText"style="width:360px;"><labelfor="winAmt">金额(万元)</label><inputid=...
<div class="editorText"style="width:360px;">
<label for="winAmt">金额(万元)</label>
<input id="winAmt" name="amt" class="easyui-numberbox" value="0" data-options="required:true,validType:['length[0,16]'],precision:2">
</div>
<div class="editorText"style="width:360px;">
<label for="winIssuedAmt">下达资金(万元)</label>
<input id="winIssuedAmt" name="issuedAmt" class="easyui-numberbox" value="0" data-options="required:true,validType:['length[0,16]'],precision:2">
</div> 展开
<label for="winAmt">金额(万元)</label>
<input id="winAmt" name="amt" class="easyui-numberbox" value="0" data-options="required:true,validType:['length[0,16]'],precision:2">
</div>
<div class="editorText"style="width:360px;">
<label for="winIssuedAmt">下达资金(万元)</label>
<input id="winIssuedAmt" name="issuedAmt" class="easyui-numberbox" value="0" data-options="required:true,validType:['length[0,16]'],precision:2">
</div> 展开
展开全部
监控下input的值改变事件,如果值大于了下面的下达金额,则提示警告。
追问
js不熟给个例子行么?谢谢挺急的。。
追答
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<body>
<div class="editorText"style="width:360px;">
<label for="winAmt">金额(万元)</label>
<input id="winAmt" name="amt" class="easyui-numberbox" value="0" onchange="tochang()" data-options="required:true,validType:['length[0,16]'],precision:2">
</div>
<div class="editorText"style="width:360px;">
<label for="winIssuedAmt">下达资金(万元)</label>
<input id="winIssuedAmt" name="issuedAmt" class="easyui-numberbox" value="0" data-options="required:true,validType:['length[0,16]'],precision:2">
</div>
<script>
function tochang(){
var input1 = document.getElementById("winAmt");
var input2 = document.getElementById("winIssuedAmt");
if(input1.value > input2.value){
alert("警告:金额的值大于下达金额")
}
}
</script>
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询