用JAVASCRIPT如何判断父窗体的子窗体是否打开,如果没有打开则打开子窗体,如果已经打开,则不打开

jinchun 2002-07-30 12:34:48
用JAVASCRIPT如何判断父窗体的子窗体是否打开,如果没有打开则打开子窗体,如果已经打开,则不打开
...全文
46 4 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
evonne_feng 2002-07-30
  • 打赏
  • 举报
回复
if(subWin == null) //subWin为子窗口的名字

liuzxit 2002-07-30
  • 打赏
  • 举报
回复
書上的例子﹐不知對你有沒有用

<HTML>
<HEAD>
<TITLE>Window Focus() and Blur()</TITLE>
<SCRIPT LANGUAGE="JavaScript1.1">
// declare global variable name
var newWindow = null
function makeNewWindow() {
// check if window already exists
if (!newWindow || newWindow.closed) {
// store new window object in global variable
newWindow = window.open("","","width=250,height=250")
// pause briefly to let IE3 window finish opening
setTimeout("fillWindow()",100)
} else {
// window already exists, so bring it forward
newWindow.focus()
}
}
// assemble new content and write to subwindow
function fillWindow() {
var newContent = "<HTML><HEAD><TITLE>Another Sub Window</TITLE></HEAD>"
newContent += "<BODY bgColor='salmon'>"
newContent += "<H1>A Salmon-Colored Subwindow.</H1>"
newContent += "<FORM><INPUT TYPE='button' VALUE='Bring Main to Front' onClick='self.opener.focus()'>"
newContent += "<FORM><INPUT TYPE='button' VALUE='Put Me in Back' onClick='self.blur()'>"
newContent += "</FORM></BODY></HTML>"
// write HTML to new window document
newWindow.document.write(newContent)
newWindow.document.close()
}
</SCRIPT>
</HEAD>
<BODY>
<H1>Window focus() and blur() Methods</H1>
<HR>
<FORM>
<INPUT TYPE="button" NAME="newOne" VALUE="Show New Window" onClick="makeNewWindow()">
</FORM>
</BODY>
</HTML>
jinchun 2002-07-30
  • 打赏
  • 举报
回复
上面的两位说对了
但是如果是判断a.asp是否已经打开,如果没有打开则打开,如果打开了,则关闭后再打开,该怎么做,急………在线等待
jinchun 2002-07-30
  • 打赏
  • 举报
回复
上面的两位说对了
但是如果是判断a.asp是否已经打开,如果没有打开则打开,如果打开了,则关闭后再打开,该怎么做,急………在线等待

28,409

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧