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

Javascript
有趣的script标签用getAttribute方法来自脚本吧
学习YUI.Ext 第二天
学习YUI.Ext 第三天
学习YUI.Ext第五日--做拖放Darg&Drop
学习YUI.Ext 第六天--关于树TreePanel(Part 1)
学习YUI.Ext 第七天--关于View&JSONView
学习YUI.Ext 第六天--关于树TreePanel(Part 2异步获取节点)
对YUI扩展的Gird组件 Part-2
Gird事件机制初级读本
为Yahoo! UI Extensions Grid增加内置的可编辑器
如何简单地用YUI做JavaScript动画
(function(){})()的用法与优点
JS层移支示例代码
如何在Web页面上直接打开、编辑、创建Office文档
网页中实现浏览器的最大,最小化和关闭按钮
[原创]js与自动伸缩图片 自动缩小图片的多浏览器兼容的方法总结
图片自动缩小的js代码,用以防止图片撑破页面
收藏一些不常用,但是有用的代码
解决 firefox 不支持 document.all的方法
用ajax实现的自动投票的代码

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


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-12   浏览: 31 ::
收藏到网摘: 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]为图片地址