| 搜硕在线_给首页加一个轮显广告,图片轮着显示 |
| 来源:搜硕在线 作者:yoyb_com 发布时间:2007-11-02 |
|
给首面加一个轮显广告,图片轮着显示
搜硕提供代码,此代码演示:http://www.yoyb.com/yoyb_ys/xianads.html
以下内容为程序代码:
<Script Language="JavaScript">
<!--
function SlidePic1(ID) {this.ID=ID; this.Width=0;this.Height=0; this.TimeOut=5000; this.Effect=23; this.TitleLen=0; this.PicNum=-1; this.Img=null; this.Url=null; this.Title=null; this.AllPic=new Array(); this.Add=AddSlidePic1; this.Show=ShowSlidePic1; this.LoopShow=LoopShowSlidePic1;}
function NewSlide1() {this.ImgUrl=""; this.LinkUrl=""; this.Title="";}
function AddSlidePic1(SP) {this.AllPic[this.AllPic.length] = SP;}
function ShowSlidePic1() {
if(this.AllPic[0] == null) return false;
document.write('<div align="center"><a id="Url' + this.ID + '" href=""><img id="Img' + this.ID + '" width=' + this.Width + ' height=' + this.Height + ' style="filter: revealTrans(duration=2,transition=23);" src="javascript:null" border="0"></a>');
if(this.TitleLen != 0) document.write("<br><Div id='Title" + this.ID + "'></Div></div>");
this.Img = document.getElementById("Img" + this.ID);
this.Url = document.getElementById("Url" + this.ID);
this.Title = document.getElementById("Title" + this.ID);
this.LoopShow();
}
function LoopShowSlidePic1() {
if(this.PicNum<this.AllPic.length-1) this.PicNum++ ;
else this.PicNum=0;
this.Img.filters.revealTrans.Transition=this.Effect;
this.Img.filters.revealTrans.apply();
this.Img.src=this.AllPic[this.PicNum].ImgUrl;
this.Img.filters.revealTrans.play();
this.Url.href=this.AllPic[this.PicNum].LinkUrl;
if(this.Title) this.Title.innerHTML='<a href="'+this.AllPic[this.PicNum].LinkUrl+'" >'+this.AllPic[this.PicNum].Title+'</a>';
this.Img.timer=setTimeout(this.ID+".LoopShow()",this.TimeOut);
}
var SlidePic1 = new SlidePic1("SlidePic1");
SlidePic1.Width = 230;
SlidePic1.Height = 200;
SlidePic1.TimeOut = 5000;
SlidePic1.Effect = 23;
SlidePic1.TitleLen = 1;
var NewItem = new NewSlide1();
NewItem.ImgUrl = 'http://www.yoybcom/pic/tu1/1.jpg';
NewItem.LinkUrl= 'http://qq.yoyb.com/article/1/30/200706/1946.html';
NewItem.Title = '<span>搜硕QQ-浪漫爱情图片我们说好了不分手</span>';
SlidePic1.Add(NewItem);
var NewItem = new NewSlide1();
NewItem.ImgUrl = 'http://www.yoybcom/pic/tu1/2.jpg';
NewItem.LinkUrl= 'http://qq.yoyb.com/article/1/30/200710/3639.html';
NewItem.Title = '<span>搜硕QQ-非主流图片帅哥美女共26张</span>';
SlidePic1.Add(NewItem);
var NewItem = new NewSlide1();
NewItem.ImgUrl = 'http://www.yoybcom/pic/tu1/3.gif';
NewItem.LinkUrl= 'http://qq.yoyb.com/article/1/30/200706/1946.html';
NewItem.Title = '<span>搜硕QQ-闪字闪图及论坛顶贴图</span>';
SlidePic1.Add(NewItem);
var NewItem = new NewSlide1();
NewItem.ImgUrl = 'http://www.yoybcom/pic/tu1/4.gif';
NewItem.LinkUrl= 'http://qq.yoyb.com/article/1/30/200706/1946.html1';
NewItem.Title = '<span>搜硕QQ-QQ空间回复提醒设置</span>';
SlidePic1.Add(NewItem);
var NewItem = new NewSlide1();
NewItem.ImgUrl = 'http://www.yoybcom/pic/tu1/5.gif';
NewItem.LinkUrl= 'http://qq.yoyb.com/article/1/30/200706/1946.html';
NewItem.Title = '<span>搜硕QQ-改变QQ空间首页模板布局</span>';
SlidePic1.Add(NewItem);
var NewItem = new NewSlide1();
NewItem.ImgUrl = 'http://www.yoybcom/pic/tu1/6.gif';
NewItem.LinkUrl= 'http://qq.yoyb.com/article/1/30/200706/1946.html';
NewItem.Title = '<span>搜硕QQ-QQ空间新手学堂专题</span>';
SlidePic1.Add(NewItem);
SlidePic1.Show();
//-->
</Script> |
将以上代码加入您的主页上< body>< /body>之间即可,虽然简单但效果不错,快去试试吧。相关专题:HTML进阶应用技巧
|
| | |
| 上一篇:搜硕在线文章
下一篇:搜硕在线文章 |
|
【关闭窗口】 |
|
| |
|