|
发表于 2006 年 6 月 9 日 15:48:55
|
显示全部楼层
第一步:在<body>中加入:OnLoad="doPopup();"
例如:
- <body OnLoad="doPopup();">
复制代码
第二步:在<body></body>区间的任意位置加入:
- <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://qinrui.net.ru"; // change to your popup page URL
- width = 600; // width of window in pixels
- height = 500; // height of window in pixels
- delay = 150; // time in seconds before popup opens
- if (get_cookie('popped')==''){
- timer = setTimeout("Start(url, width, height)", delay*1000);
- document.cookie="popped=yes"
- }
- }
- // End -->
- </script>
复制代码
[ 本帖最后由 loiter 于 2006-6-9 15:52 编辑 ] |
|