?? 12.3 使窗口只第一次訪問時彈出.htm
字號:
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>標題頁</title>
<script LANGUAGE="JavaScript">
//彈出窗口的方法
function openpopup(){
window.open("http://www.baidu.com","","width=300,height=300") //設置打開窗口
}
function get_cookie(Name)
{
var search = Name + "="
var returnvalue = "";
if (document.cookie.length > 0) {
offset = document.cookie.indexOf(search)
if (offset != -1) { // 如果指定的cookie已經存在
offset += search.length // 長度指定到cookie值的位置
end = document.cookie.indexOf(";", offset); // 判斷是否還包括其他cookie值
if (end == -1) //如果不包括
end = document.cookie.length; //獲取cookie的長度
returnvalue=unescape(document.cookie.substring(offset, end)) //獲取cookie的值
}
}
return returnvalue;
}
function loadpopup(){
if (get_cookie("popped")==""){ //判斷是否已經彈出過窗口
openpopup() //如果沒有則彈出窗口
document.cookie="popped=yes" //設置cookie值
}
}
</script>
</head>
<body>
<input type=button name="btn1" value="打開窗口!" onclick="loadpopup()">
</body>
</html>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -