JS 浏览器兼容性问题汇总

  一、

 function calculate(index) {

        if (index != null) {
            currentStep = $(index).parent().parent().find("td:first-child").html();
        }
        if (currentStep == 0) {
            alert('未能获得所在行焦点,无法自动计算!');
            return false;
        }
        else {
            currentStep =parseInt( currentStep)+ 1;
            var tab = document.getElementById("content");
            var price = tab.rows[currentStep].cells[4].innerHTML;    
            var $thisTD = $(index).parents("tr").find("td:eq(5)");         //此处需获取某td内  控件的值  使用childNote 在ie下可以 不兼容chrome 故改用 JQuery
            var Quantity = $thisTD.find("input").val();
            var total = (price * Quantity).toFixed(2);
            alert(price);
            alert(Quantity);
            alert(total);
            tab.rows[currentStep].cells[6].innerHTML = total;
        }

    }

二、Jquery的.html()方法可能会带有特殊符号,所以尽量避免使用,还是使用 input 更为保险。

如var ID = $(this).find("td:eq(0)").find("input").val();

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值