兩個javascript廣告模板 網頁對聯廣告+網頁橫幅廣告

來源:互聯網
上載者:User

(1)template_banner

function ObjectAD() {<br /> /* Define Variables*/<br /> this.ADID = 0;<br /> this.ADType = 0;<br /> this.ADName = "";<br /> this.ImgUrl = "";<br /> this.ImgWidth = 0;<br /> this.ImgHeight = 0;<br /> this.FlashWmode = 0;<br /> this.LinkUrl = "";<br /> this.LinkTarget = 0;<br /> this.LinkAlt = "";<br /> this.Priority = 0;<br /> this.CountView = 0;<br /> this.CountClick = 0;<br /> this.InstallDir = "";<br /> this.ADDIR = "";<br /> this.OverdueDate = "";<br />}<br />function BannerZoneAD(_id) {<br /> /* Define Constants */<br /> this.adNum = 0;<br /> this.adDelay = 6000;<br /> /* Define Common Variables*/<br /> this.ID = _id;<br /> this.ZoneID = 0;<br /> this.ZoneName = "";<br /> this.ZoneWidth = 0;<br /> this.ZoneHeight = 0;<br /> this.ShowType = 1;<br /> this.DivName = "";<br /> this.Div = null;<br /> /* Define Unique Variables*/<br /> /* Define Objects */<br /> this.AllAD = new Array();<br /> this.ShowAD = null;<br /> /* Define Functions */<br /> this.AddAD = BannerZoneAD_AddAD;<br /> this.GetShowAD = BannerZoneAD_GetShowAD;<br /> this.Show = BannerZoneAD_Show;<br /> this.LoopShow = BannerZoneAD_LoopShow;<br />}<br />function BannerZoneAD_AddAD(_AD) {<br /> var date = new Date();<br /> var getdate = date.getFullYear() + "/" + (date.getMonth() + 1) + "/" + date.getDate();<br /> var today = new Date(getdate);<br /> var overdueDate = new Date(_AD.OverdueDate);<br /> if(today <= overdueDate)<br /> {<br /> this.AllAD[this.AllAD.length] = _AD;<br /> }<br />}<br />function BannerZoneAD_GetShowAD() {<br /> if (this.ShowType > 1) {<br /> this.ShowAD = this.AllAD[0];<br /> return;<br /> }<br /> var num = this.AllAD.length;<br /> var sum = 0;<br /> for (var i = 0; i < num; i++) {<br /> sum = sum + this.AllAD[i].Priority;<br /> }<br /> if (sum <= 0) {return ;}<br /> var rndNum = Math.random() * sum;<br /> i = 0;<br /> j = 0;<br /> while (true) {<br /> j = j + this.AllAD[i].Priority;<br /> if (j >= rndNum) {break;}<br /> i++;<br /> }<br /> this.ShowAD = this.AllAD[i];<br />}<br />function BannerZoneAD_Show() {<br /> if (!this.AllAD) {<br /> return;<br /> } else {<br /> this.GetShowAD();<br /> }<br /> if (this.ShowAD == null) return false;<br /> this.DivName = "BannerZoneAD_Div" + this.ZoneID;<br /> if (!this.ShowAD.ImgWidth) this.ShowAD.ImgWidth = this.ZoneWidth<br /> if (!this.ShowAD.ImgHeight) this.ShowAD.ImgHeight = this.ZoneHeight<br /> if (this.ShowAD.ADDIR=="") this.ShowAD.ADDIR = "AD"<br /> if (this.ShowType == 3) {<br /> if(document.all) {<br /> document.write("<div id='" + this.DivName + "' style='visibility:visible; z-index:1; width:" + this.ZoneWidth + "px; height:" + this.ZoneHeight + "px; filter: revealTrans(duration=2,transition=20);'>" + AD_Content(this.ShowAD) + "</div>");<br /> }<br /> else {<br /> document.write("<div id='" + this.DivName + "' style='visibility:visible; z-index:1; width:" + this.ZoneWidth + "px; height:" + this.ZoneHeight + "px'>" + AD_Content(this.ShowAD) + "</div>");<br /> }<br /> }<br /> else {<br /> document.write("<div id='" + this.DivName + "' style='visibility:visible; z-index:1; width:" + this.ZoneWidth + "px; height:" + this.ZoneHeight + "px;'>" + AD_Content(this.ShowAD) + "</div>");<br /> if (this.ShowAD.CountView) {<br /> document.write ("<script src="" + this.ShowAD.InstallDir + this.ShowAD.ADDIR + "/ADCount.aspx?Action=View&ADID=" + this.ShowAD.ADID + "" mce_src="" + this.ShowAD.InstallDir + this.ShowAD.ADDIR + "/ADCount.aspx?Action=View&ADID=" + this.ShowAD.ADID + ""></" + "script>")<br /> }<br /> }<br /> this.Div = document.getElementById(this.DivName);<br /> if (this.ShowType == 3) this.LoopShow();<br />}<br />function BannerZoneAD_LoopShow() {<br /> if(document.all) {<br /> if(this.adNum<this.AllAD.length-1) this.adNum++ ;<br /> else this.adNum=0;<br /> this.Div.filters.revealTrans.Transition=Math.floor(Math.random()*23);<br /> this.Div.filters.revealTrans.apply();<br /> if (this.AllAD[this.adNum].ImgWidth) this.AllAD[this.adNum].ImgWidth = this.ZoneWidth<br /> if (this.AllAD[this.adNum].ImgHeight) this.AllAD[this.adNum].ImgHeight = this.ZoneHeight<br /> this.Div.innerHTML=AD_Content(this.AllAD[this.adNum]);<br /> this.Div.filters.revealTrans.play()<br /> this.Div.timer=setTimeout(this.ID+".LoopShow()",this.adDelay);<br /> }<br /> else {<br /> if(this.adNum<this.AllAD.length-1) this.adNum++ ;<br /> else this.adNum=0;<br /> if (this.AllAD[this.adNum].ImgWidth) this.AllAD[this.adNum].ImgWidth = this.ZoneWidth<br /> if (this.AllAD[this.adNum].ImgHeight) this.AllAD[this.adNum].ImgHeight = this.ZoneHeight<br /> this.Div.innerHTML=AD_Content(this.AllAD[this.adNum]);<br /> this.Div.timer=setTimeout(this.ID+".LoopShow()",this.adDelay);<br /> }<br />}<br />function AD_Content(o) {<br /> var str = "";<br /> if (o.ADType == 1 || o.ADType == 2) {<br /> imgurl = o.ImgUrl .toLowerCase()<br /> if (o.InstallDir.indexOf("http://") != - 1) imgurl = o.InstallDir.substr(0, o.InstallDir.length - 1) + imgurl;<br /> if (imgurl.indexOf(".swf") != - 1) {<br /> str = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0'";<br /> str += " name='AD_" + o.ADID + "' id='AD_" + o.ADID + "'";<br /> str += " width='" + o.ImgWidth + "px'";<br /> str += " height='" + o.ImgHeight + "px'";<br /> if (o.style) str += " style="" + o.style + "" mce_style="" + o.style + """;<br /> if (o.extfunc) str += " " + o.extfunc + " ";<br /> str += ">";<br /> str += "<param name='movie' value='" + imgurl + "'>";<br /> if (o.FlashWmode == 1) str += "<param name='wmode' value='Transparent'>";<br /> if (o.play) str += "<param name='play' value='" + o.play + "'>";<br /> if (typeof(o.loop) != "undefined") str += "<param name='loop' value='" + o.loop + "'>";<br /> str += "<param name='quality' value='autohigh'>";<br /> str += "<embed ";<br /> str += " name='AD_" + o.ADID + "' id='AD_" + o.ADID + "'";<br /> str += " width='" + o.ImgWidth + "px'";<br /> str += " height='" + o.ImgHeight + "px'";<br /> if (o.style) str += " style="" + o.style + "" mce_style="" + o.style + """;<br /> if (o.extfunc) str += " " + o.extfunc + " ";<br /> str += " src="" + imgurl + "" mce_src="" + imgurl + """;<br /> if (o.FlashWmode == 1) str += " wmode='Transparent'";<br /> if (o.play) str += " play='" + o.play + "'";<br /> if (typeof(o.loop) != "undefined") str += " loop='" + o.loop + "'";<br /> str += " quality='autohigh'"<br /> str += " pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash'></embed>";<br /> str += "</object>";<br /> } else if (imgurl.indexOf(".gif") != - 1 || imgurl.indexOf(".jpg") != - 1 || imgurl.indexOf(".jpeg") != - 1 || imgurl.indexOf(".bmp") != - 1 || imgurl.indexOf(".png") != - 1) {<br /> if (o.LinkUrl) {<br /> if (o.CountClick) o.LinkUrl = o.InstallDir + o.ADDIR + "/ADCount.aspx?Action=Click&ADID=" + o.ADID<br /> str += "<a href="" + o.LinkUrl + "" mce_href="" + o.LinkUrl + "" target='" + ((o.LinkTarget == 0) ? "_self" : "_blank") + "' title='" + o.LinkAlt + "'>";<br /> }<br /> str += "<img ";<br /> str += " name='AD_" + o.ADID + "' id='AD_" + o.ADID + "'";<br /> if (o.style) str += " style="" + o.style + "" mce_style="" + o.style + """;<br /> if (o.extfunc) str += " " + o.extfunc + " ";<br /> str += " src="" + imgurl + "" mce_src="" + imgurl + """;<br /> if (o.ImgWidth) str += " width='" + o.ImgWidth + "px'";<br /> if (o.ImgHeight) str += " height='" + o.ImgHeight + "px'";<br /> str += " border='0'>";<br /> if (o.LinkUrl) str += "</a>";<br /> }<br /> } else if (o.ADType == 3 || o.ADType == 4) {<br /> str = o.ADIntro<br /> } else if (o.ADType == 5) {<br /> str = "<iframe id='" + "AD_" + o.ADID + "' marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=no width=100% height=100% src="" + o.ADIntro + "" mce_src="" + o.ADIntro + "">wait</iframe>";<br /> }<br /> return str;<br />} 

(1)template_couplet

function ObjectAD() {<br /> /* Define Variables*/<br /> this.ADID = 0;<br /> this.ADType = 0;<br /> this.ADName = "";<br /> this.ImgUrl = "";<br /> this.ImgWidth = 0;<br /> this.ImgHeight = 0;<br /> this.FlashWmode = 0;<br /> this.LinkUrl = "";<br /> this.LinkTarget = 0;<br /> this.LinkAlt = "";<br /> this.Priority = 0;<br /> this.CountView = 0;<br /> this.CountClick = 0;<br /> this.InstallDir = "";<br /> this.ADDIR = "";<br /> this.OverdueDate = "";<br />}<br />function CoupletZoneAD(_id) {<br /> /* Define Common Variables*/<br /> this.ID = _id;<br /> this.ZoneID = 0;<br /> this.ZoneName = "";<br /> this.ZoneWidth = 0;<br /> this.ZoneHeight = 0;<br /> this.ShowType = 1;<br /> this.DivNameLeft = "";<br /> this.DivLeft = null;<br /> this.DivNameRight= "";<br /> this.DivRight = null;<br /> /* Define Unique Variables*/<br /> this.Left = 0;<br /> this.Top = 0;<br /> this.Delta = 0.15;<br /> this.ShowCloseAD = false;<br /> this.CloseFontColor = "#FFFFFF";<br /> /* Define Objects */<br /> this.AllAD = new Array();<br /> this.ShowLeftAD = null;<br /> this.ShowRightAD = null;<br /> /* Define Functions */<br /> this.AddAD = CoupletZoneAD_AddAD;<br /> this.GetShowAD = CoupletZoneAD_GetShowAD;<br /> this.Show = CoupletZoneAD_Show;<br /> this.Move = CoupletZoneAD_Move;<br /> this.GetRight = CoupletZoneAD_GetRight;<br /> this.GetRandomNum = CoupletZoneAD_GetRandomNum;<br /> this.WriteAD = CoupletZoneAD_WriteAD;<br /> this.GetMove = CoupletZoneAD_GetMove;<br />}<br />function CoupletZoneAD_AddAD(_AD) {<br /> var date = new Date();<br /> var getdate = date.getFullYear() + "/" + (date.getMonth() + 1) + "/" + date.getDate();<br /> var today = new Date(getdate);<br /> var overdueDate = new Date(_AD.OverdueDate);<br /> if(today <= overdueDate)<br /> {<br /> this.AllAD[this.AllAD.length] = _AD;<br /> }<br />}<br />function CoupletZoneAD_GetShowAD() {<br /> if (this.ShowType >1) {<br /> if(this.AllAD.length <= 1){<br /> this.ShowLeftAD = this.AllAD[0];<br /> }<br /> else{<br /> this.ShowLeftAD = this.AllAD[0];<br /> this.ShowRightAD = this.AllAD[1];<br /> }<br /> return;<br /> }<br /> if(this.AllAD.length <= 1){<br /> this.ShowLeftAD = this.AllAD[this.GetRandomNum()];<br /> }<br /> else{<br /> this.ShowLeftAD = this.AllAD[this.GetRandomNum()];<br /> this.ShowRightAD = this.AllAD[this.GetRandomNum()];<br /> }<br />}<br />function CoupletZoneAD_GetRandomNum(){<br /> var sum = 0;<br /> for (var i = 0; i < this.AllAD.length; i++) {<br /> sum = sum + this.AllAD[i].Priority;<br /> }<br /> if (sum <= 0) {return ;}<br /> var rndNum = Math.random() * sum;<br /> i = 0;<br /> j = 0;<br /> while (true) {<br /> j = j + this.AllAD[i].Priority;<br /> if (j >= rndNum) {break;}<br /> i++;<br /> }<br /> return i;<br />}<br />function CoupletZoneAD_Show() {<br /> if (!this.AllAD) {<br /> return;<br /> } else {<br /> this.GetShowAD();<br /> }<br /> if (this.ShowLeftAD == null){<br /> return false;<br /> }<br /> else{<br /> this.DivNameLeft = "MoveZoneAD_Div" + this.ZoneID+"_left";<br /> this.DivNameRight = "MoveZoneAD_Div" + this.ZoneID+"_right";<br /> this.WriteAD(this.ShowLeftAD,this.DivNameLeft,this.Left);<br /> this.DivLeft = document.getElementById(this.DivNameLeft);<br /> if(this.AllAD.length <= 1){<br /> this.WriteAD(this.ShowLeftAD,this.DivNameRight,this.GetRight());<br /> }<br /> else{<br /> this.WriteAD(this.ShowRightAD,this.DivNameRight,this.GetRight());<br /> if(this.ShowRightAD.CountView){<br /> document.write("<mce:script src="" + this.ShowRightAD.InstallDir + this.ShowRightAD.ADDIR + "/ADCount.aspx?Action=View&ADID=" + this.ShowRightAD.ADID + "" mce_src="" + this.ShowRightAD.InstallDir + this.ShowRightAD.ADDIR + "/ADCount.aspx?Action=View&ADID=" + this.ShowRightAD.ADID + ""></mce:script>")<br /> }<br /> }<br /> if(this.ShowLeftAD.CountView){<br /> document.write("<mce:script src="" + this.ShowLeftAD.InstallDir + this.ShowLeftAD.ADDIR + "/ADCount.aspx?Action=View&ADID=" + this.ShowLeftAD.ADID + "" mce_src="" + this.ShowLeftAD.InstallDir + this.ShowLeftAD.ADDIR + "/ADCount.aspx?Action=View&ADID=" + this.ShowLeftAD.ADID + ""></mce:script>")<br /> }<br /> this.DivRight = document.getElementById(this.DivNameRight);<br /> }<br /> setInterval(this.ID + ".Move()", 10);<br />}<br />function CoupletZoneAD_WriteAD(ShowAD,DivName,Left){<br /> if (!ShowAD.ImgWidth) ShowAD.ImgWidth = this.ZoneWidth<br /> if (!ShowAD.ImgHeight) ShowAD.ImgHeight = this.ZoneHeight<br /> if (ShowAD.ADDIR=="") ShowAD.ADDIR = "AD"<br /> document.write("<div id='" + DivName + "' style='position:absolute; z-index:1; width:" + this.ZoneWidth + "px;height:" + this.ZoneHeight + "px;left:" + Left + "px;top:" + this.Top + "px'>" + AD_Content(ShowAD) + "");<br /> if(this.ShowCloseAD){<br /> document.write("<div style='position: absolute;right: 0px;bottom: 0px;'><span onclick='AD_CloseDL(/"" + DivName + "/");' style="cursor: pointer;font-size:12px;color:" + this.CloseFontColor + ";text-decoration:none;" mce_style="cursor: pointer;font-size:12px;color:" + this.CloseFontColor + ";text-decoration:none;">關閉</span></div>");<br /> }<br /> document.write("</div>");<br />}<br />function CoupletZoneAD_GetRight(){<br /> if (window.innerWidth) {<br /> return window.innerWidth-16 - this.Left - this.ZoneWidth;<br /> }else{<br /> return document.documentElement.clientWidth - this.Left - this.ZoneWidth;<br /> }<br />}<br />function CoupletZoneAD_Move() {<br /> if(document.all) {<br /> pageX=window.document.documentElement.scrollLeft;<br /> pageY=window.document.documentElement.scrollTop;<br /> }<br /> else {<br /> pageX=window.pageXOffset;<br /> pageY=window.pageYOffset;<br /> }<br /> if(this.DivLeft != null){<br /> this.GetMove(pageX,pageY,this.DivLeft,this.Left);<br /> }<br /> if(this.DivRight != null){<br /> this.GetMove(pageX,pageY,this.DivRight,this.GetRight());<br /> }<br />}<br />function CoupletZoneAD_GetMove(pageX,pageY,Div,Left){<br /> if (Div.offsetLeft != (pageX + Left)) {<br /> var dx = (pageX + Left - Div.offsetLeft) * this.Delta;<br /> dx = (dx > 0 ? 1 : - 1) * Math.ceil(Math.abs(dx));<br /> Div.style.left = Div.offsetLeft + dx + "px";<br /> }<br /> if (Div.offsetTop != (pageY + this.Top)) {<br /> var dy = (pageY + this.Top - Div.offsetTop) * this.Delta;<br /> dy = (dy > 0 ? 1 : - 1) * Math.ceil(Math.abs(dy));<br /> Div.style.top = Div.offsetTop + dy + "px";<br /> }<br /> Div.style.display = '';<br />}<br />function AD_CloseDL(d){<br /> document.getElementById(d).style.visibility = "hidden";<br />}<br />function AD_Content(o) {<br /> var str = "";<br /> if (o.ADType == 1 || o.ADType == 2) {<br /> imgurl = o.ImgUrl .toLowerCase()<br /> if (o.InstallDir.indexOf("http://") != - 1) imgurl = o.InstallDir.substr(0, o.InstallDir.length - 1) + imgurl;<br /> if (imgurl.indexOf(".swf") != - 1) {<br /> str = "<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0'";<br /> str += " name='AD_" + o.ADID + "' id='AD_" + o.ADID + "'";<br /> str += " width='" + o.ImgWidth + "px'";<br /> str += " height='" + o.ImgHeight + "px'";<br /> if (o.style) str += " style="" + o.style + "" mce_style="" + o.style + """;<br /> if (o.extfunc) str += " " + o.extfunc + " ";<br /> str += ">";<br /> str += "<param name='movie' value='" + imgurl + "'>";<br /> if (o.FlashWmode == 1) str += "<param name='wmode' value='Transparent'>";<br /> if (o.play) str += "<param name='play' value='" + o.play + "'>";<br /> if (typeof(o.loop) != "undefined") str += "<param name='loop' value='" + o.loop + "'>";<br /> str += "<param name='quality' value='autohigh'>";<br /> str += "<embed ";<br /> str += " name='AD_" + o.ADID + "' id='AD_" + o.ADID + "'";<br /> str += " width='" + o.ImgWidth + "px'";<br /> str += " height='" + o.ImgHeight + "px'";<br /> if (o.style) str += " style="" + o.style + "" mce_style="" + o.style + """;<br /> if (o.extfunc) str += " " + o.extfunc + " ";<br /> str += " src="" + imgurl + "" mce_src="" + imgurl + """;<br /> if (o.FlashWmode == 1) str += " wmode='Transparent'";<br /> if (o.play) str += " play='" + o.play + "'";<br /> if (typeof(o.loop) != "undefined") str += " loop='" + o.loop + "'";<br /> str += " quality='autohigh'"<br /> str += " pluginspage='http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash'></embed>";<br /> str += "</object>";<br /> } else if (imgurl.indexOf(".gif") != - 1 || imgurl.indexOf(".jpg") != - 1 || imgurl.indexOf(".jpeg") != - 1 || imgurl.indexOf(".bmp") != - 1 || imgurl.indexOf(".png") != - 1) {<br /> if (o.LinkUrl) {<br /> if (o.CountClick) o.LinkUrl = o.InstallDir + o.ADDIR + "/ADCount.aspx?Action=Click&ADID=" + o.ADID<br /> str += "<a href="" + o.LinkUrl + "" mce_href="" + o.LinkUrl + "" target='" + ((o.LinkTarget == 0) ? "_self" : "_blank") + "' title='" + o.LinkAlt + "'>";<br /> }<br /> str += "<img ";<br /> str += " name='AD_" + o.ADID + "' id='AD_" + o.ADID + "'";<br /> if (o.style) str += " style="" + o.style + "" mce_style="" + o.style + """;<br /> if (o.extfunc) str += " " + o.extfunc + " ";<br /> str += " src="" + imgurl + "" mce_src="" + imgurl + """;<br /> if (o.ImgWidth) str += " width='" + o.ImgWidth + "px'";<br /> if (o.ImgHeight) str += " height='" + o.ImgHeight + "px'";<br /> str += " border='0'>";<br /> if (o.LinkUrl) str += "</a>";<br /> }<br /> } else if (o.ADType == 3 || o.ADType == 4) {<br /> str = o.ADIntro<br /> } else if (o.ADType == 5) {<br /> str = "<iframe id='" + "AD_" + o.ADID + "' marginwidth=0 marginheight=0 hspace=0 vspace=0 frameborder=0 scrolling=no width=100% height=100% src="" + o.ADIntro + "" mce_src="" + o.ADIntro + "">wait</iframe>";<br /> }<br /> return str;<br />} 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.