<%
if Request.Cookies("ad")=Nothing then
Request.Cookies("ad")="1"
response.write " <script language='javascript'>广告代码 </script>"
end if
%>
if Request.Cookies("ad")=Nothing then
Request.Cookies("ad")="1"
response.write " <script language='javascript'>广告代码 </script>"
end if
%>
<script>
if(document.cookie.indexOf('open=true') == -1){
window.open("XXX");
}
document.cookie = 'open=true';
</script>
请问这句应该怎么用呢?
xxx是广告代码的意思,这个我知道,但是这里面可以直接写js了么?js可以写在js里面嘛?
<script type="text/javascript" src="js/ad.js"></script>可以把上面这句替换成XXX,是这个意思嘛?
还是说XXX变成ad.html 然后在ad.html里面插入上面这句?
response.cookies("open=true").expires=DateAdd("d",1,now())
%>
这个是我用asp写的让cookies一天失效,但是不知道如何写成js请高人指点迷津呢
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>
再者,广告是出来了,可主页内容都没了、除非关了再开不过的确是1天只显示一次嘎嘎