今天弄了个弹出窗口的js,但问题出现了,我点击按钮打开新窗口,然后关闭新窗口再打开,会提示错误信息,有的时候不会弹出错误信息,正常打开新的页面,有的时候会,这个很纠结,贴出代码 让大家看看。
<script language="javascript" type="text/javascript">
var childObj;
function newWindow() {
childObj = window.open('ContentPage.aspx', 'child', 'width=500,height=300');
childObj.moveTo((window.screen.width - 355) / 2, (window.screen.height - 470) / 2);
childObj.focus();
var btnOjb = document.getElementById("btnCommmit");
btnOjb.disabled = true;
}
</script>
<script language="javascript" type="text/javascript">
var childObj;
function newWindow() {
childObj = window.open('ContentPage.aspx', 'child', 'width=500,height=300');
childObj.moveTo((window.screen.width - 355) / 2, (window.screen.height - 470) / 2);
childObj.focus();
var btnOjb = document.getElementById("btnCommmit");
btnOjb.disabled = true;
}
</script>
btnOjb.disabled = true;
这个代码是父页面的~
<script language="javascript" type="text/javascript">
var childObj;
function newWindow() {
childObj = window.open('ContentPage.aspx', 'child', 'width=500,height=300');
childObj.moveTo((window.screen.width - 355) / 2, (window.screen.height - 470) / 2);
childObj.focus();
}
</script>
如果这样还有错误呢?点击第一次没错误,关闭子窗口,继续点击 就会报错!