?? 14-29.htm
字號(hào):
<HTML>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=gb2312">
<TITLE>window對(duì)象的focus()和blur()方法示例</TITLE>
<SCRIPT LANGUAGE="JavaScript">
var newWindow = null // declare global variable name,null相當(dāng)于false
function makeNewWindow() {
if (!newWindow||newWindow.closed) { // check if window already exists
newWindow = window.open("","","width=350,height=150")
// store new window object in global variable
// assemble content for new window
var newContent = "<HTML><TITLE>新打開的子窗口</TITLE></HEAD>"
newContent += "<BODY bgColor='yellow'><H2>這是一個(gè)背景色為yellow的由主窗口打開的子窗口</H2>"
newContent += "<FORM><INPUT TYPE='button' VALUE='將主窗口放到前臺(tái)' onClick='self.opener.focus()'>"
//self.opener用來指定主(父)窗口
newContent += "<INPUT TYPE='button' VALUE='將本窗口放到后臺(tái)' onClick='self.blur()'>"
newContent += "</FORM></BODY></HTML>"
newWindow.document.write(newContent) // write HTML to new window document
} else {
newWindow.focus() // window already exists, so bring it forward
}
}
</SCRIPT>
</HEAD>
<BODY>
<H2>
<FONT face="華文彩云">本窗口是主窗口</FONT>
</H2>
<br>
<FONT size="4">單擊下面的按鈕將打開一個(gè)子窗口:</FONT>
<FORM>
<br>
<INPUT TYPE="button" NAME="newOne" VALUE="打開一個(gè)新的子窗口" onClick="makeNewWindow()">
</FORM>
</BODY>
</HTML>
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -