for (var n = 0; n < data.length; n++) {
if (data[n].abici_bankfullcode == ssb_bankCode)
p += "<option value=\"" + data[n].abici_bankfullcode + "\" selected=\"selected\" id=\"" + data[n].abici_bankfullcode + "\" onclick=\"selectbank(" + data[n].abici_bankfullcode + ")\">" + data[n].abici_bankfullname + "</option>";
else
p += "<option value=\"" + data[n].abici_bankfullcode + "\" id=\"" + data[n].abici_bankfullcode + "\" onclick=\"selectbank(" + data[n].abici_bankfullcode + ")\">" + data[n].abici_bankfullname + "</option>";
}
最开始是这样写的在电脑上打开一点问题都没有,但是上传到服务器,用手机打开onclick事件就无法使用,然后把option标签换成li还是不行,后台又在li外面加了a标签,然后把onclick事件放在a标签里,这么做就没了问题
for (var n = 0; n < data.length; n++) {
if (data[n].abici_bankfullcode == ssb_bankCode)
p += "<a href=‘javascript:void(0)‘ onclick=\‘selectbank(" + data[n].abici_bankfullcode +")\‘><li style=‘background:#57B1E6;‘>" + data[n].abici_bankfullname + "</li></a>";
else
p += "<a href=‘javascript:void(0)‘ onclick=\‘selectbank(" + data[n].abici_bankfullcode +")\‘><li>" + data[n].abici_bankfullname + "</li></a>";
}