当前位置: 首页 > 图文教程 > 网络编程 > Javascript > 从新浪弄下来的全屏广告代码 与使用说明

Javascript
我也种棵OO树JXTree[js+css+xml]
新浪中用来显示flash的函数
JXTree对象,读取外部xml文件数据,生成树的函数
用js来格式化字符串示例模仿css
js prototype 格式化数字 By shawl.qiu
新浪刚打开页面出来的全屏广告代码
记录几个javascript有关的小细节
Some tips of wmi scripting in jscript (1)
JavaScript Try...Catch 声明的 使用方法
JS版获取字符串真实长度和取固定长度的字符串函数
Javascript中的数学函数
ArrayList类(增强版)
javascript中巧用“闭包”实现程序的暂停执行功能
javascript判断单选框或复选框是否选中方法集锦
FireFox的getYear的注意事项
JavaScript For...In 使用方法
JavaScript Switch 声明
JavaScript If...Else 声明
JavaScript For 循环
JavaScript While 循环 教程

Javascript 中的 从新浪弄下来的全屏广告代码 与使用说明


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-12   浏览: 47 ::
收藏到网摘: n/a

<!--全屏开始--><!--interstitial begin-->
<SCRIPT language=JavaScript>
<!--
//时间计算
SYfullscreen=false;
today=new Date();
function testdate()
{
if(today.getMonth()=='2') //是否为3月
{
if(today.getDate()=='15') //是否为15日
{
<!--725A3E8355CB-->//全屏开始
if(today.getHours()>='14' && today.getHours()<'15')
{
adInterPath='http://ad4.sina.com.cn/sina/ae/ad_src/fullscreen/fullscreenv2.html?
http://sina.allyes.com/main/adfclick?
db=sina&bid=73474,105318,105433&cid=0,0,0&sid=97875&advid=3716&camid=14291&show=ignore&url=http://61.49.38.5/tzhddoc/index.ht
m${}/upload/2007315152115702.jpg';SYfullscreen=true
}<!--$$ huiyan/2007-3-15 14:00:01 ~ 2007-3-15 14:59:59/B $-->
<!--4774607C08FD-->//全屏开始
if(today.getHours()>='8' && today.getHours()<'9')
{
adInterPath='http://ad4.sina.com.cn/sina/ae/ad_src/fullscreen/fullscreenv2.html?
http://sina.allyes.com/main/adfclick?
db=sina&bid=73474,105318,105433&cid=0,0,0&sid=97875&advid=3716&camid=14291&show=ignore&url=http://61.49.38.5/tzhddoc/index.ht
m${}/upload/2007315152115903.JPG';SYfullscreen=true
}<!--$$ raowei/2007-3-15 ~ 2007-3-16 两天勿撤,谢谢!/B $-->
<!--35F6B37FB5E4-->//全屏开始
if(today.getHours()>='16' && today.getHours()<'17')
{
adInterPath='http://ad4.sina.com.cn/sina/ae/ad_src/fullscreen/fullscreenv2.html?
http://sina.allyes.com/main/adfclick?
db=sina&bid=70483,101960,102064&cid=0,0,0&sid=94712&advid=3254&camid=13506&show=ignore&url=http://www.sagitar.com.cn/${}
/upload/2007315152115985.GIF';SYfullscreen=true
}<!--$$ limeng/2007-3-15 16:00:01 ~ 2007-3-15 16:59:59/B $-->
<!--C5EB1D51E54C-->//全屏开始
if(today.getHours()>='17' && today.getHours()<'18')
{
adInterPath='http://ad4.sina.com.cn/sina/ae/ad_src/fullscreen/fullscreenv2.html?
http://sina.allyes.com/main/adfclick?
db=sina&bid=73214,104975,105088&cid=0,0,0&sid=97562&advid=3705&camid=14237&show=ignore&url=http://adclient.dentsu.com.cn/html
.ng/adspec=Flash&adtype=single_dui_lian&affiliate=sina&campaignid=842&channel=aoyun_page&log=0¶ms.styles=clickcmd?${}
/upload/2007315152115273.jpg';SYfullscreen=true
}<!--$$ limeng/2007-3-15 17:00:01 ~ 2007-3-15 17:59:59/B $-->
<!--D4C112442CAF-->//全屏开始
if(today.getHours()>='18' && today.getHours()<'19')
{
adInterPath='http://ad4.sina.com.cn/sina/ae/ad_src/fullscreen/fullscreenv2.html?
http://sina.allyes.com/main/adfclick?
db=sina&bid=73271,105059,105175&cid=0,0,0&sid=97643&advid=3254&camid=14234&show=ignore&url=http://www.sagitar.com.cn/olympic$
{}/upload/2007315152115162.jpg';SYfullscreen=true
}<!--$$ limeng/2007-3-15 ~ 2007-3-15/B $-->
}}}
testdate();
var MSIE=navigator.userAgent.indexOf("MSIE");
var OPER=navigator.userAgent.indexOf("Opera");
if(SYfullscreen==true)
{
if (document.all && MSIE!=-1 && OPER==-1) {
// this is a 4.x browser, no?
function changediv(){
document.getElementById('hiddenLayer').style.display = "block";
document.getElementById('interstitialFrame').src = adInterPath;
setTimeout("hidediv()",5000)
}
function hidediv(){
document.getElementById('hiddenLayer').style.display="none";
SYtag=2;
}
function showfull(){
setTimeout("changediv()",2000);
}
showfull();
}
}
// -->
</SCRIPT>
<SCRIPT language=JavaScript>
<!--
if(SYfullscreen==true)
{
if (document.all && MSIE!=-1 && OPER==-1) {
// this is a 4.x browser, no?
document.write('<DIV ID="hiddenLayer" style="display: none; height: 450px;">');
expandableIframe = '<IFRAME id="interstitialframe" width=750 HEIGHT=450 NORESIZE SCROLLING=No FRAMEBORDER=0
MARGINHEIGHT=0 MARGINWIDTH=0></IFRAME>';
document.write(expandableIframe);
}
document.write('</div>');
}
// -->
</SCRIPT>
<!--interstitial end--><!--全屏结束-->
说明新浪主要是根据时间段来显示不同的广告,然后将动态控制iframe来显示广告
有个重要的文件
http://ad4.sina.com.cn/sina/ae/ad_src/fullscreen/fullscreenv2.html
的代码如下,用${}作为分割符,利用了数组
复制代码 代码如下:

<html><head>
<meta http-equiv="Content-type" content="text/html; charset=gb2312">
<title>新浪广告</title>
</head>
<body bgcolor=#ffffff topmargin=0 marginheight=0 leftmargin=0 marginwidth=0>
<center>
<script language = javascript>
var par = location.search.substr(1);
var ary = par.split("${}");
document.writeln("<a href='" + ary[0] + "' target=_blank><img src=" + ary[1] + " width=750 height=450 border=0></a>");
</script>
</center>
</body></html>

ary[0]为连接地址
ary[1]为图片地址