| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 631 人关注过本帖
标题:父窗口和子窗口的问题
只看楼主 加入收藏
pjwistcc
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2007-6-18
收藏
 问题点数:0 回复次数:0 
父窗口和子窗口的问题

问题
1.按"在新窗口中累加"有时会报错,大概是新窗口还未装载好,无法识别aWin.txt
2.在按"新窗口"时,如何将先前的新窗口覆盖,我先检测新窗口aWin是否已经打开,如果打开则先关闭;然后用的是open里的_blank但是不行,后来改成_media就行了,但在ie下好象不认.
以下是代码,望高手帮下小弟
<html> //test.php
<head>
</head>
<script language="javascript">
var aaa=1;
var aWin=1;
function nwindow()
{if(aWin.open)
aWin.close;
aWin=window.open("information1.php","_media","top=0,left=0,width=200,height=200,toolbar=no");
aWin.focus();
}
function opentwo()
{document.all.first.disabled=false;
document.all.second.disabled=false;
document.all.ynnew.disabled=true;
}
function nouse()
{document.all.first.disabled=true;
document.all.second.disabled=true;
}
function addone()
{if(aWin.open)
aWin.close;
aWin=window.open("information2.php","_media","top=0,left=0,width=200,height=200,toolbar=no");

aWin.focus();
aWin.txt1.value=aaa;
aaa=aaa+1;
}
function winclose()
{aWin.close();
document.all.first.disabled=true;
document.all.second.disabled=true;
document.all.ynnew.disabled=false;}
</script>
<INPUT TYPE="button" ID=nwin VALUE="新窗口" onClick="nwindow()">
<INPUT TYPE="button" name=ynnew value="打开后面2个" onClick="opentwo()">
<INPUT TYPE="button" name=first value="在新窗口中累加" onClick="addone()">
<INPUT TYPE="button" name=second value="关闭新窗口" onClick="winclose()"> <br>
<body onload="nouse()">
</body>
</html>


<script language="javascript"> //information1.php
window.setTimeout("window.close()",10000);
</script>
<body>
<center><h3>通知</h3></center>
10秒中后,这个窗口自动关闭!
<center><input type="button" value="关闭" onCLICK="window.close()"></center>
</body>


<body> //informtion2.php
<center><h3>通知</h3></center>
<br>
<script language="javascript">
</script>
你已经点击"在新窗口中累加"按钮<input type="text" value="1" id=txt1 style="width:20px;height:20px"> 次了!!!
<center><input type="button" value="关闭" onCLICK="window.close()"></center>
</body>

搜索更多相关主题的帖子: 窗口 
2007-06-18 16:27
快速回复:父窗口和子窗口的问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016682 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved