</script>
È»ºó£¬ÔÙÓÃ<body onload="closeit()"> ÕâÒ»¾ä»°´úÌæpage.htmlÖÐÔÓеÄ<BODY>ÕâÒ»¾ä¾Í¿ÉÒÔÁË¡£( ÕâÒ»¾ä»°Ç§Íò²»ÒªÍü¼Çд°¡£¡ÕâÒ»¾äµÄ×÷ÓÃÊǵ÷Óùرմ°¿ÚµÄ´úÂ룬10ÃëÖÓºó¾Í×ÔÐйرոô°¿Ú¡£)
¡¾7¡¢ÔÚµ¯³ö´°¿ÚÖмÓÉÏÒ»¸ö¹Ø±Õ°´Å¥¡¿
<FORM>
<INPUT TYPE='BUTTON' VALUE='¹Ø±Õ' onClick='window.close()'>
</FORM>
ºÇºÇ£¬ÏÖÔÚ¸ü¼ÓÍêÃÀÁË£¡
¡¾8¡¢ÄÚ°üº¬µÄµ¯³ö´°¿Ú-Ò»¸öÒ³ÃæÁ½¸ö´°¿Ú¡¿
ÉÏÃæµÄÀý×Ó¶¼°üº¬Á½¸ö´°¿Ú£¬Ò»¸öÊÇÖ÷´°¿Ú£¬ÁíÒ»¸öÊǵ¯³öµÄС´°¿Ú¡£
ͨ¹ýÏÂÃæµÄÀý×Ó£¬Äã¿ÉÒÔÔÚÒ»¸öÒ³ÃæÄÚÍê³ÉÉÏÃæµÄЧ¹û¡£
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
function openwin()
{OpenWindow=window.open("", "newwin", "height=250,
width=250,toolbar=no,scrollbars="+scroll+",menubar=no");
//д³ÉÒ»ÐÐ
OpenWindow.document.write("<TITLE>Àý×Ó</TITLE>")
OpenWindow.document.write("<BODY BGCOLOR=#ffffff>")
OpenWindow.document.write("<h1>Hello!</h1>")
OpenWindow.document.write("New window opened!")
OpenWindow.document.write("</BODY>")
OpenWindow.document.write("</HTML>")
OpenWindow.document.close()}
</SCRIPT>
</head>
<body>
<a href="#" onclick="openwin()">´ò¿ªÒ»¸ö´°¿Ú</a>
<input type="button" onclick="openwin()" value="´ò¿ª´°¿Ú">
</body>
</html>
¿´¿´ OpenWindow.document.write()ÀïÃæµÄ´úÂë²»¾ÍÊDZê×¼µÄHTMLÂð£¿Ö»Òª°´ÕÕ¸ñʽд¸ü¶àµÄÐм´¿É¡£Ç§Íò×¢Òâ¶àÒ»¸ö±êÇ©»òÉÙÒ»¸ö±êÇ©¾Í»á³öÏÖ´íÎ󡣼ǵÃÓÃOpenWindow.document.close()½áÊø°¡¡£
¡¡¡¡ ¡¾9¡¢ÖÕ¼«Ó¦ÓÃ--µ¯³öµÄ´°¿ÚÖ®Cookie¿ØÖÆ¡¿
»ØÏëһϣ¬ÉÏÃæµÄµ¯³ö´°¿ÚËäÈ»¿á£¬µ«ÊÇÓÐÒ»µãС벡(³Á½þÔÚϲÔÃÖ®ÖУ¬Ò»¶¨Ã»Óз¢ÏÖ°É£¿)±ÈÈçÄ㽫ÉÏÃæµÄ½Å±¾·ÅÔÚÒ»¸öÐèҪƵ·±¾¹ýµÄÒ³ÃæÀï(ÀýÈçÊ×Ò³)£¬ÄÇôÿ´ÎË¢ÐÂÕâ¸öÒ³Ã棬´°¿Ú¶¼»áµ¯³öÒ»´Î£¬
ÊDz»ÊǷdz£·³ÈË£¿:-(Óнâ¾öµÄ°ì·¨Âð£¿Yes! ;-) Follow me.ÎÒÃÇʹÓÃcookieÀ´¿ØÖÆһϾͿÉÒÔÁË¡£
Ê×ÏÈ£¬½«ÈçÏ´úÂë¼ÓÈëÖ÷Ò³ÃæHTMLµÄ<HEAD>Çø£º
<script>
function openwin()
{window.open("page.html","","width=200,height=200")}
function get_cookie(Name)
{var search = Name + "="
var returnvalue = "";
if (document.cookie.length >0) {
offset = document.cookie.indexOf(search) if (offset != -1) {
offset += search.length end = document.cookie.indexOf(";", offset);
if (end == -1)
end = document.cookie.length; returnvalue=unescape(document.cookie.substring(offset,end))
}
}
return returnvalue;
}
function loadpopup(){
if (get_cookie('popped')==''){
openwin()
document.cookie="popped=yes"
}
}
</script>
È»ºó£¬ÓÃ<body onload="loadpopup()">£¨×¢Òâ²»ÊÇopenwin¶øÊÇloadpop°¡£¡£©Ìæ»»Ö÷Ò³ÃæÖÐÔÓÐµÄ <BODY>ÕâÒ»¾ä¼´¿É¡£Äã¿ÉÒÔÊÔ×ÅË¢ÐÂÒ»ÏÂÕâ¸öÒ³Ãæ»òÖØнøÈë¸ÃÒ³Ã棬´°¿ÚÔÙÒ²²»»áµ¯³öÁË¡£ÕæÕýµÄPop
-Only-Once£¡
дµ½ÕâÀﵯ³ö´°¿ÚµÄÖÆ×÷ºÍÓ¦Óü¼ÇÉ»ù±¾ÉÏËãÊÇÍê³ÉÁË£¬°³Ò²ÀÛ»µÁË£¬Ò»¿ÚÆø˵ÁËÕâô¶à£¬Ï£Íû¶ÔÕýÔÚÖÆ×÷ÍøÒ³µÄÅóÓÑÓÐËù°ïÖú°³¾Í·Ç³£ÐÀοÁË¡£
ÐèҪעÒâµÄÊÇ£¬JS½Å±¾ÖеĵĴóСд×îºÃÇ°ºó±£³ÖÒ»ÖÂ