Following Script isn’t working in CHROME browser, IE is Fine.
I’ve changed opener.document… to window.opener.document…. but same situation.
It’s not closing windows and transfer data to parent page.
function mycoupon() {
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');
}
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 <b><font color='red'>Total : " + maskNum(tot) + " USD</font></b> ";
opener.cal_payment_money();
self.close();
}
Define a global variable and assign a reference to the new window then use it in your
sel_coupon()function.Here’s an example:
In case you’re interested in the reason of this behavior, it’s because IE assumes that the default
windowis the most recent one. So that’s why when you run the code on IE it will try to findopenerin the new window, but other browsers are a bit more strict (which is better in this case)