自由设定弹出窗口时间并且一天只弹一次 - 中国WEB开发者网络 (http://www.webasp.net) -- 网页特效 (http://www.webasp.net/javascript/) --- 自由设定弹出窗口时间并且一天只弹一次 (http://www.webasp.net/javascript/1/392.htm) |
| -- 发布日期: 2005-06-07 |
| <!-- 网页特效代码由[中国WEB开发者网络:http://www.ChinaWebDev.com]提供! --> <!-- 要实现此效果需要 2 个步骤: --> <!-- 第 1 步: --> <!-- 把<BODY>中的属性代码改为: --> <BODY OnLoad="doPopup();"> <!-- 第 2 步: --> <!-- 把下面的代码加到<BODY></BODY>区域中: --> 等3秒... <SCRIPT LANGUAGE="JavaScript"> <!-- Begin closetime = 0; // Close window after __ number of seconds? // 0 = do not close, anything else = number of seconds function Start(URL, WIDTH, HEIGHT) { windowprops = "menubar=no,toolbar=no,status=no,scrollbars=no,resizable=no,left=200,top=50,width=" + WIDTH + ",height=" + HEIGHT; preview = window.open(URL, "preview",windowprops); if (closetime) setTimeout("preview.close();", closetime*1000); } function get_cookie(Name) { var search = Name + "=" var returnvalue = ""; if (document.cookie.length > 0) { offset = document.cookie.indexOf(search) if (offset != -1) { // if cookie exists offset += search.length // set index of beginning of value end = document.cookie.indexOf(";", offset); // set index of end of cookie value if (end == -1) end = document.cookie.length; returnvalue=unescape(document.cookie.substring(offset, end)) } } return returnvalue; } function doPopup() { url = "http://www.webasp.net"; // change to your popup page URL width = 600; // width of window in pixels height = 500; // height of window in pixels delay = 3; // time in seconds before popup opens if (get_cookie('popped')==''){ timer = setTimeout("Start(url, width, height)", delay*1000); document.cookie="popped=yes" } } // End --> </script> |
| webasp.net |