<% 
if Request.Cookies("ad")=Nothing then 
Request.Cookies("ad")="1"
response.write " <script language='javascript'>广告代码 </script>" 
end if 
%> 

解决方案 »

  1.   


    <script>
    if(document.cookie.indexOf('open=true') == -1){
        window.open("XXX");
    }
    document.cookie = 'open=true';
    </script>
      

  2.   

    啊哦好像最好在设置一下cookies的有效期,一天显示一次。
      

  3.   

    window.open("XXX");
    请问这句应该怎么用呢?
    xxx是广告代码的意思,这个我知道,但是这里面可以直接写js了么?js可以写在js里面嘛?
    <script type="text/javascript" src="js/ad.js"></script>可以把上面这句替换成XXX,是这个意思嘛?
    还是说XXX变成ad.html 然后在ad.html里面插入上面这句?
      

  4.   

    <%
    response.cookies("open=true").expires=DateAdd("d",1,now())
    %>
    这个是我用asp写的让cookies一天失效,但是不知道如何写成js请高人指点迷津呢
      

  5.   

    将下面的代码复制到phpcms的模板中(*.htm)即可哦……<script>
    function window.onload(){
        laohai = document.cookie;
        if(laohai.indexOf('check=true')==-1){
       
         //这个位置可以放你要运行的代码,当然,也可以是广告代码,也可以调用JS
         document.writeln("你好");
    //这个位置可以放你要运行的代码当然,也可以是广告代码,也可以调用JS      curr = new Date();
          exptdate = new Date(curr.getYear(),curr.getMonth(),curr.getDate()+1);
          document.cookie = "check=true;expires="+(exptdate.toGMTString());
        }
    }
    </script>
      

  6.   

    js里写js,可以是可以,但是出现了两个、不算很理想……
    再者,广告是出来了,可主页内容都没了、除非关了再开不过的确是1天只显示一次嘎嘎