Google chrome CHROME中未捕获的类型错误

Google chrome CHROME中未捕获的类型错误,google-chrome,popup,Google Chrome,Popup,我以前也问过同样的问题。但它在CHROME上仍然有错误,但在IE上效果很好。 父html调用mycupon3.jsp作为弹出窗口,如果选择了弹出窗口中的一行,它将INNERHTML发送给父html 问题是,弹出窗口中的数据不能处理为父html。chrome dubugging tools上显示未捕获的TypeError:无法读取opener.document.joinform.all[tot].innerHTML上未定义的属性“tot”。此外,弹出窗口不会自动关闭 我认为所有[tot]都与chr

我以前也问过同样的问题。但它在CHROME上仍然有错误,但在IE上效果很好。 父html调用mycupon3.jsp作为弹出窗口,如果选择了弹出窗口中的一行,它将INNERHTML发送给父html

问题是,弹出窗口中的数据不能处理为父html。chrome dubugging tools上显示未捕获的TypeError:无法读取opener.document.joinform.all[tot].innerHTML上未定义的属性“tot”。此外,弹出窗口不会自动关闭

我认为所有[tot]都与chrome不兼容。 因此将其更改为opener.document.joinform.getelementbyid[tot].innerHTML,但运气不佳

这是代码

<parent html>

 <td id="tot" class="text_orange"><%=NumberFormat.getInstance().format(cmbean.getTotal())%> USD</td>

 <a href="javascript: mycoupon()"><img src="/images/main/mycoupon_btn.gif" border="0"></a>


<script>

var new_window_handle;  

function mycoupon() {     
new_window_handle = window.open("my_coupon3.jsp?amt=<%=pay_price2%>", 'coupon_win', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes, resizable=no,width=780,height=540'); 
} 

</script>   

<my_coupon3.jsp> * POPUP window

<script>
function sel_coupon(c_id, amt) {
var tot = opener.document.joinform.Org_totalprice.value ;
tot = String( Number(tot) - Number(amt) ) ;
opener.document.joinform.totalprice.value = tot;
opener.document.joinform.coupon_id.value = c_id ;
opener.document.joinform.all["tot"].innerHTML = maskNum    (opener.document.joinform.Org_totalprice.value) + "USD - " + maskNum(amt) +" USD &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b><font color='red'>TOTAL : " + maskNum(tot) + " USD</font></b> ";
opener.cal_payment_money() ;
self.close();
}
</script>

<a href="javascript: sel_coupon('BGG30055901', '3000')"> Apply This coupon</a>
getElementById不是对象,而是函数。叫它:

document.getElementById('tot')

请注意,您必须将其应用于文档;单个元素没有getElementById。这就是使用中的问题;尽管Chrome支持所有这些功能是为了与Internet Explorer设计的页面兼容,但它只支持将其作为文档属性。

谢谢。但是chrome调试器说/Uncaught TypeError:Object[Object HTMLFormElement]没有方法“getElementById”@paulycho:当我说document.getElementById时,我指的是opener.document.getElementById,而不是opener.document.joinform.getElementById。请务必阅读答案的其余部分,而不仅仅是第一句。谢谢。我解决了这个问题。我写错了getElementById的大写字母。Chrome区分大小写。所有浏览器都区分大小写,仅供参考: