怎么解决jquery与IE不兼容
2017-04-04 · 百度知道合伙人官方认证企业
育知同创教育
1【专注:Python+人工智能|Java大数据|HTML5培训】 2【免费提供名师直播课堂、公开课及视频教程】 3【地址:北京市昌平区三旗百汇物美大卖场2层,微信公众号:yuzhitc】
向TA提问
关注
展开全部
解决jquery与IE不兼容:
代码:
function getuser(stuno){
$.getJSON("users_findbystuno.action",{stuno:stuno,d:new Date().getTime()}, function(json){
var $name = $("#re_name");
$name.empty();
if(json.length > 0){
for(var i = 0; i < json.length; i++){
var opt = new Option();
opt.value= json[i].name;
opt.text= json[i].name;
$name.append(opt);
}
}else{
var opt = new Option();
opt.text= "该学号不存在";
$name.append(opt);
}
});
}
页面:
<form method="post" action="repair_add.action" id="addForm" style="padding-top:5px;">
<table width="100%" class="pn-ftable" cellpadding="2" cellspacing="1" border="0">
<tr><td width="10%" class="pn-flabel pn-flabel-h"><span class="pn-frequired">*</span>输入学号:</td><td colspan="1" width="80%" class="pn-fcontent" ><input type="text" size="40" maxlength="80" id="stuno" name="stuno" onchange="getuser(this.value)"/></td></tr>
<tr><td width="10%" class="pn-flabel pn-flabel-h"><span class="pn-frequired">*</span>报修人:</td>
<td colspan="1" width="80%" class="pn-fcontent"><select name="repairs.re_name" id="re_name" ></select></td></tr>
</form>
代码:
function getuser(stuno){
$.getJSON("users_findbystuno.action",{stuno:stuno,d:new Date().getTime()}, function(json){
var $name = $("#re_name");
$name.empty();
if(json.length > 0){
for(var i = 0; i < json.length; i++){
var opt = new Option();
opt.value= json[i].name;
opt.text= json[i].name;
$name.append(opt);
}
}else{
var opt = new Option();
opt.text= "该学号不存在";
$name.append(opt);
}
});
}
页面:
<form method="post" action="repair_add.action" id="addForm" style="padding-top:5px;">
<table width="100%" class="pn-ftable" cellpadding="2" cellspacing="1" border="0">
<tr><td width="10%" class="pn-flabel pn-flabel-h"><span class="pn-frequired">*</span>输入学号:</td><td colspan="1" width="80%" class="pn-fcontent" ><input type="text" size="40" maxlength="80" id="stuno" name="stuno" onchange="getuser(this.value)"/></td></tr>
<tr><td width="10%" class="pn-flabel pn-flabel-h"><span class="pn-frequired">*</span>报修人:</td>
<td colspan="1" width="80%" class="pn-fcontent"><select name="repairs.re_name" id="re_name" ></select></td></tr>
</form>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询