落伍者站长论坛's Archiver

hitxiong 发表于 2008-4-14 14:00

20元 就修改30行代码左右,有关游客弹窗24小时显示一次的

<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns="http://www.w3.org/TR/REC-html40">

<head>
</head>

<script language="JavaScript">
adTime=8;
chanceAd=1;
var ns=(document.layers);
var ie=(document.all);
var w3=(document.getElementById && !ie);
adCount=0;

//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 initAd(){
        if(!ns && !ie && !w3) return;
        if(ie)                adDiv=eval('document.all.sponsorAdDiv.style');
        else if(ns)        adDiv=eval('document.layers["sponsorAdDiv"]');
        else if(w3)        adDiv=eval('document.getElementById("sponsorAdDiv").style');
        randAd=Math.ceil(Math.random()*chanceAd);
        if (ie||w3)
        adDiv.visibility="visible";
        else
        adDiv.visibility ="show";
        if(randAd==1) showAd();
}
function showAd(){
//if (get_cookie('popped')==''){
    if(adCount<adTime*10){adCount+=1;
        if (ie){documentWidth  =document.body.offsetWidth/2+document.body.scrollLeft-20;
        documentHeight =document.body.offsetHeight/2+document.body.scrollTop-20;}
        else if (ns){documentWidth=window.innerWidth/2+window.pageXOffset-20;
        documentHeight=window.innerHeight/2+window.pageYOffset-20;}
        else if (w3){documentWidth=self.innerWidth/2+window.pageXOffset-20;
        documentHeight=self.innerHeight/2+window.pageYOffset-20;}
        adDiv.left=documentWidth-200;adDiv.top =documentHeight-160;
        setTimeout("showAd()",100);}else closeAd();
//        document.cookie="popped=yes"
   }
}

function closeAd(){
if (ie||w3)
adDiv.display="none";
else
adDiv.visibility ="hide";
}

onload = initAd

</script>

<body>
<DIV id=sponsorAdDiv style="position: absolute;visibility: hidden;height: 1;width: 1;top: 50;left: 50" align=center onselectstart="return false;">
<table width=260 height=160 bgcolor=#0099FF style="border: 1 outset #FFFFFF"><tr><td>
<table width=245 height=145 bgcolor=FFFFFF align=center style="border: 1 inset #EEEEEE">
<tr><td align=center valign=middle>
<P><b><font size="4" color="#FF0000">甜蜜家园糖尿病论坛!<br></font></b><font size="5" color="red"><font face="华文行楷"> 让生活更美好</font>^_^</font><P>
<b><font size="5" color="#008000">tnbz.com</font></b><font color="red"><font size="4"><br></font><br>
</font>请注册或登陆<b><font size="4">拥有</font></b>更多朋友噢!<br><br>
<b><a href=register.php title=按这里进行注册><u>注 册</u></a>  
<a href=logging.php?action=login title=从这里开始登入家庭><u>登 陆</u></a></b><p>(15秒后本窗口自动关闭)</p>  <span style="cursor:hand" onclick="closeAd();return false"><font color="#999999">关闭提示</font></span>  </td></tr></table></td></tr></table></div>

</body>

小闲云野鹤 发表于 2008-4-14 14:00

:) 帮顶

hitxiong 发表于 2008-4-14 14:06

这段代码的目的时实现 游客注册提示
参考:
[url]http://www.discuz.net/viewthread.php?tid=580135&highlight=%D7%A2%B2%E1%CC%E1%CA%BE[/url]

但是有个毛病,游客 浏览每个页面都会 提示注册登录,很烦。

希望改成,只提示一次,可以是24小时提示一次,或者在这次浏览过程中,只提示一次。

参考:
[url]http://www.discuz.net/thread-8892-1-1.html[/url]

[url]http://www.discuz.net/viewthread.php?tid=14499[/url]

[url]http://www.discuz.net/thread-132914-1-1.html[/url]

[url]http://www.discuz.net/thread-524385-1-1.html[/url]

[url]http://www.baidu.com/s?lm=0&si=&rn=10&ie=gb2312&ct=0&wd=site%3Awww%2Ediscuz%2Enet+%B5%AF%B3%F6+%D2%BB%B4%CE&pn=20&ver=0&cn=baidu04&cl=3[/url]

蓝晶 发表于 2008-4-14 16:28

要用javascript操作cookie哦..........

lwlsw 发表于 2008-4-14 18:16

改东西看的是技术含量而不是代码行数多少!:mad:

hitxiong 发表于 2008-4-14 18:41

貌似不是特别复杂。

ligenwin 发表于 2008-4-14 20:38

此问题从外表看  是不怎么复杂~      可是等你上手就知道了 ~      基本大家都认为使用javacript都可以搞定~     其实不是那个样子地~


此非彼也~      棒顶一下~    :ohh:


cookie 是一门很深的学问   最起码我是这么看的~

[[i] 本帖最后由 ligenwin 于 2008-4-14 20:41 编辑 [/i]]

hitxiong 发表于 2008-4-14 21:35

自己搞定,就加了一行代码,哈哈

dreal 发表于 2008-4-14 22:29

不错的想法,不过弹窗很烦人

页: [1]

Powered by Discuz! Archiver 6.1.0  © 2001-2007 Comsenz Inc.