disabled的使用方法

<tr><th>畅游票价</th><td><input type="text" id="pass_price"name="passPrice" onblur="checkPrice();"/></td></tr>

上面onblur对下面的调用事件:

<tr><th>门票区间</th><td><select id="purview1" name="purview"disabled="disabled"><option value="0">请选择</option>c:forEach items="${spotsPurviewList}"var="spotsPurview" varStatus="vsspotsPurview"><option id="spotsPurview${spotsPurview.keyCode}"

value="${spotsPurview.keyCode}">${spotsPurview.value1}</option>

</c:forEach></select> <input id="purview"name="purview" type="hidden"></td></tr>

Js的使用:(注意大括号的使用)

function checkPrice(){
var market_price= parseFloat($("#market_price").val());

$("#market_price").val(market_price);

var pass_price= parseFloat($("#pass_price").val());

$("#pass_price").val(pass_price);

if($("#pass_price").val()== "" ||$("#pass_price").val()<0){#pass_price").val(0);

}if($("#pass_price").val()>= 0 && $("#pass_price").val() < 50)

{$("#purview1").val("01");

$("#purview").val("01");

}if($("#pass_price").val()>= 50 && $("#pass_price").val() < 100){
$("#purview1").val("02");

$("#purview").val("02");

} if($("#pass_price").val()>= 100){
$("#purview1").val("03");

$( "#purview").val( "03");}}

posted @ 2021-11-12 19:46  aixuexi666888  阅读(168)  评论(0编辑  收藏  举报