js一个代码,在谷歌浏览器正常,在ie不正常,怎么回事啊

代码之城 2018-05-27 10:00:56
<script> 
function checkInt(o){
theV=isNaN(parseInt(o.value))?0:parseInt(o.value);
if(theV!=o.value){o.value=theV;}
var num =shuliang.value*Price.value/6.3;
txtTotal.value = num.toFixed(2); //
}


function checkP(o){
theV=isNaN(parseFloat(o.value))?0:parseFloat(o.value);
theV=parseInt(theV*100)/100;
if(theV!=o.value){
theV=(theV*100).toString();
theV=theV.substring(0,theV.length-2)+"."+theV.substring(theV.length-2,theV.length)
o.value=theV;
}
var num =shuliang.value*Price.value/6.3;
txtTotal.value = num.toFixed(2);

}
</script>


<tr width="782" height="32">
<td align="right">
   <b>Page Price(¥):</b></td><td><input id="Price" value="0" name="Price" style="width:250px;" onKeyUp="checkP(this);" onpaste="checkP(this);" oncut="checkP(this);" ondrop="checkP(this);" onChange="checkP(this);" />

<input id="txtTotal" value=0 style="border-right-width:0px;margin-right:0px;" readonly> <input style="border-left-width:0px;margin-left:-4px;width:18px" value="$" readonly>

(* Required)
</td>

</tr>
<tr width="782" height="32">
<td align="right" >
   <b>quantity:</b></td><td><input id="shuliang" name="shuliang" style="width:250px;" value="1" onKeyUp="checkInt(this);" onpaste="checkInt(this);" oncut="checkInt(this);" ondrop="checkInt(this);" onChange="checkInt(this);" />
</td>

哪里出错了,SCRIPT5009: “shuliang”未定义
xxx-agent.asp, 行43 字符2
...全文
1431 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
Anubis_K 2018-05-29
  • 打赏
  • 举报
回复
浏览器兼容性不同
qq_42333629 2018-05-29
  • 打赏
  • 举报
回复
谷歌对于代码的支持性比较高
懒笑翻 2018-05-28
  • 打赏
  • 举报
回复
有时候IE浏览器确实不兼容 你可以试试F12 调试
Triumph 2018-05-28
  • 打赏
  • 举报
回复
在 crhome 中你可以直接用控件的名称来引用元素,但这不是标准的用法,所以兼容性不好。 应该用 document.getElementById("shuliang") 或者 document.querySelector("#shuliang")
伟洪winni 2018-05-28
  • 打赏
  • 举报
回复
IE有些函数不兼容
风中的少年 2018-05-27
  • 打赏
  • 举报
回复
估计ie 10以下需要 shuliang = getElementById; 用Jquery吧。
代码之城 2018-05-27
  • 打赏
  • 举报
回复
找到错误了, 代码多了几个;号

87,907

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧