让窗口仅弹出一次

Author: 林夕 Date: 2001年 44期

?牐牭谝徊?:把如下代码加入<head>区域中
  ?牐?<SCRIPT language="JavaScript">
  ?牐?<!--
  ?牐爁unction openpopup(){
  ?牐爓indow.open("welcome.htm","","width=300,height=300")??
  ?牐爙
  ?牐爁unction get_cookie(Name){?? ??
  ?牐爒ar search=Name + "="
  ?牐爒ar returnvalue = "";
  ?牐爄f(document.cookie.length > 0){?? ??
  ?牐爋ffset=document.cookie.indexOf(search)
  ?牐爄f(offset!= -1){// if cookie exists
  ?牐爋ffset +=search.length
  ?牐?//set index of beginning of value
  ?牐爀nd = document.cookie.indexOf(";",offset);?牔?
  ?牐?//set index of end of cookie value
  ?牐爄f(end == -1)??
  ?牐爀nd=document.cookie.length;
  ?牐爎eturnvalue=unescape(document.cookie.substring(offset,end))?牐?
  ?牐爙
  ?牐爙??
  ?牐爎eturn returnvalue;
  ?牐爙
  ?牐爁unction loadpopup?煟牓?
  ?牐爄f(get_cookie('popped')==''){?牓?
  ?牐爋penpopup()
  ?牐燿ocument.cookie="popped=yes"
  ?牐爙
  ?牐爙??
  ?牐?//-->
  ?牐?</SCRIPT>
  ?牐牭诙?:把<body>中内容改为:
  ?牐?<body bgcolor="#fef4d9" onunload="loadpopup()>