广告代码(弹窗和富媒体)
富媒體一:
<div id="im_popupWindow_miniMsg" style="background-color: #000000;bottom: 0;position: fixed;right: 0;width: 292px;height: 220px;display: block;text-align: center;">
<table style="font-size:small">
<tr>
<td>
<span style="color:#ffffff;"> 廣告詞位置! </span>
</td>
<td style="width: 3%">
<a οnclick="cofir()">
<img src="http://csdnimg.cn/www/images/popup/pic_close.gif" alt="close" />
</a>
</td>
</tr>
</table>
<div >
<a target="_blank" href="http://events.csdn.net/SMI/main.html">
<img border="0" title="" style=" border:5 5 5 5" alt="" src="http://info-database.csdn.net/Upload/2010-11-03/280X188(4).jpg" />
</a>
</div>
</div>
?
<script type="text/javascript">
?function cofir() {
???????? document.getElementById("im_popupWindow_miniMsg").style.display = "none";
??? }
</script>
?
彈窗代碼:
JS
<script type="text/javascript">
var urllink = tcurl;//這里的tcurl 就是要彈出的地址
var twin = null;
var xy = 5;
if (tcurl.toString().indexOf('?') == -1) {
??? urllink = tcurl + "?sid=" + sid;//這里的sid 可以去掉
}
else {
??? urllink = tcurl + "&sid=" + sid;
}
twin = window.open(urllink);
? 
if (twin == null) {
??? document.write('<div id="peetcurlclick" style="position: absolute; background-color:transparent;? color:#FFFFFF"? οnclick="mck()">...</div> ');
??? function mousePosition(ev) {
??????? if (ev.pageX || ev.pageY) {
??????????? return { x: ev.pageX, y: ev.pageY };
??????? }
??????? return {
??????????? x: ev.clientX + document.documentElement.scrollLeft - document.body.clientLeft,
??????????? y: ev.clientY + document.documentElement.scrollTop - document.body.clientTop
??????? };
??? }
??? function mouseMove(ev) {
??????? ev = ev || window.event;
??????? var mousePos = mousePosition(ev);
??????? //document.getElementById('xxx').value = mousePos.x;
??????? //document.getElementById('yyy').value = mousePos.y;
??????? document.getElementById("peetcurlclick").style.top = mousePos.y - xy + "px";
??????? document.getElementById("peetcurlclick").style.left = mousePos.x - xy + "px";
??? }
??? document.onmousemove = mouseMove;
??? function mck() {
??????? window.open(urllink);
??????? xy = 100;
??????? //remove();
??? }
??? function remove() {
??????? document.getElementById('peetcurlclick').removeNode(true);
??? }
}
function Get_IE_Version() {
??? var v;
??? if (navigator.userAgent.indexOf("MSIE 6.0") > 0)//IE 6.0
??? {
??????? v = 6;
??? }
??? else if (navigator.userAgent.indexOf("MSIE 7.0") > 0)//IE 7.0 
??? {
??????? v = 7
??? }
??? return v;
}
</script>
?
?
富媒體彈窗二:(直接調用這個方法就可以輸出 頁面調用方式:在B.aspx 頁面里面加入<script src="A.aspx"></script> 代碼放在A頁面)
??? public void GetCPAHtml()
??? {
??????? var js = string.Empty;
??????? string adformat = "pic";
??????? System.Text.StringBuilder mysb = new System.Text.StringBuilder();
??????? mysb.Append("document.write('<div id=/"div11_pee_cn/" style=/"padding: 0; margin: 0; z-index: 999999; right: 0; height: 220px; width: 280px; background: url(http://s0.pic.pee.cn/pee_cpm_fmt_bg.gif);/">');" + System.Environment.NewLine);
??????? mysb.Append("document.write('<div οnclick=/"function window.open(){ return false; }/" style=/"margin: 0; padding: 5px 5px 0px 5px; width: 270px; height: 200px;/">');" + System.Environment.NewLine);
??????? if (adformat == "pic")
??????? {
??????????? mysb.Append("document.write('<a href=/"#/" target=/"_blank/"><img src=/"http://g.gaosu.com/4.gif/" alt=/"/" style=/"width: 270px; height: 200px; border-width: 0;/" /></a>');" + System.Environment.NewLine);
??????? }
??????? //if (adformat == "code")
??????? //{
??????? //??? mysb.Append("document.write('<iframe? style=/"width:270px; height:200px; margin: 0; padding: 0;/" marginwidth=/"0/" scrolling=/"no/" frameborder=/"0/"? src=/"#/"><///iframe>');" + System.Environment.NewLine);
??????? //}
??????? if (adformat == "flash")
??????? {
??????????? mysb.Append("document.write('<object id=/"pee_cpm_flash/" classid=/"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000/" width=/"270/" height=/"200/">');" + System.Environment.NewLine);
??????????? mysb.Append("document.write('<param name=/"movie/" value=/"http://s0.pic.pee.cn/sys_20101018110813.swf/" />');" + System.Environment.NewLine);
??????????? mysb.Append("document.write('<param name=/"quality/" value=/"high/" /><param name=/"wmode/" value=/"opaque/" />');" + System.Environment.NewLine);
??????????? mysb.Append("document.write('<embed width=/"270/" height=/"200/" pluginspage=/"http://www.macromedia.com/go/getflashplayer/" type=/"application/x-shockwave-flash/" wmode=/"opaque/" name=/"pee_cpm_flash/" src=/"http://s0.pic.pee.cn/sys_20101018110813.swf/" /></object>');" + System.Environment.NewLine);
??????????? mysb.Append("document.write('<div style=/"position: absolute; z-index: 9999999; top: 5px; left: 5px;/">');" + System.Environment.NewLine);
??????????? mysb.Append("document.write('<a href=/"http://c.pee.cn/cpm_fmt_click.aspx?webid=19156&adid=861&domain=9251&fromip=112.193.125.104&endurl=http%3a%2f%2fwww.bcidu.com&tt=634249862614975000&pk=ff9bab72b4aeec5ef992c3f8d0eb2e00/" target=/"_blank/"><img src=/"http://c.pee.cn/resource/tm.gif/" style=/"height: 200px; width: 270px;/" border=/"0/" /></a>');" + System.Environment.NewLine);
??????????? mysb.Append("document.write('</div>');" + System.Environment.NewLine);
??????? }
??????? mysb.Append("document.write('</div><div style=/"padding: 2px 5px; margin: 0; width: 260px; font-size: 12px; text-align: right;/">');" + System.Environment.NewLine);
??????? mysb.Append("document.write('<a href=/"http://www.pee.cn/" target=/"_blank/">                             </a> <a id=/"pee_close_btn/" οnclick=/"function window.open(){ return false; }/" style=/"color: #FFF; text-decoration: none; font-size: 12px; cursor: pointer;/" οnclick=/"function window.open(){ return false; }/" target=/"_self/"> 關閉 <img src=/"http://s0.pic.pee.cn/pee_cpm_fmt_close.gif/" style=/"margin:0; padding:0; width:11px; height:11px;/" /></a>');" + System.Environment.NewLine);
??????? mysb.Append("document.write('</div></div><script type=/"text/javascript/" src=/"http://c.pee.cn/resource/rlx.js/"><///script>');" + System.Environment.NewLine);
??????? js = mysb.ToString();
??????? //Response.Write("<!--" + System.Environment.NewLine);
??????? Response.Write(js + System.Environment.NewLine);
??????? //Response.Write("//-->" + System.Environment.NewLine);
??? }
?
?js 代碼:上面代碼里的 http://c.pee.cn/resource/rlx.js/
<script>
??? var Class = {
??????? create: function() {
??????????? return function() {
??????????????? this.initialize.apply(this, arguments);
??????????? }
??????? }
??? }
??? Function.prototype.bind = function() {
??????? var __method = this, args = $A(arguments), object = args.shift();
??????? return function() {
??????????? return __method.apply(object, args.concat($A(arguments)));
??????? }
??? }
??? var $A = Array.from = function(iterable) {
??????? if (!iterable) return [];
??????? if (iterable.toArray) {
??????????? return iterable.toArray();
??????? } else {
??????????? var results = [];
??????????? for (var i = 0; i < iterable.length; i++)
??????????????? results.push(iterable[i]);
??????????? return results;
??????? }
??? }
??? var Float = Class.create();
??? Float.prototype = {
??????? initialize: function (elem, options) {
??????????? this.toDo = options.toDo || function () { },
???this.bodyScrollTop = document.documentElement.scrollTop || document.body.scrollTop,
???this.bodyScrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft,
???this.element = document.getElementById(elem);
??????????? this.dely = options.dely || 500;
??????????? this.top = options.top || 0;
??????????? this.left = options.left || 0;
??????? },
??????? start: function () {
??????????? if (!this.element) {
??????????????? alert('please set a element first!');
??????????????? return false;
??????????? }
??????????? this.element.style.position = 'absolute';
??????????? // this.toDo();
??????????? setInterval(this.toDo.bind(this), this.dely);
??????????? //document.getElementById('div11_pee_cn').style.top = document.documentElement.clientHeight - 220 + "px";
??????????? //alert(document.getElementById('div11_pee_cn').style.top);
??????? }
??? }
??? var f = new Float('div11_pee_cn', { dely: 100,
??????? toDo: function () {
??????????? var isIE = document.all && window.external;
??????????? this.bodyScrollTop = document.documentElement.scrollTop || document.body.scrollTop;
??????????? this.bodyScrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
??????????? if (isIE) {
??????????????? this.docWidth = document.documentElement.clientWidth || document.body.clientWidth;
??????????????? this.docHeight = document.documentElement.clientHeight || document.body.clientHeight;
??????????? } else {
??????????????? this.docWidth = document.documentElement.clientWidth; //(document.body.clientWidth > document.documentElement.clientWidth) ? document.documentElement.clientWidth : document.body.clientWidth;
??????????????? this.docHeight = document.documentElement.clientHeight - 5; //(document.body.clientHeight > document.documentElement.clientHeight) ? document.documentElement.clientHeight : document.body.clientHeight;
??????????? }
??????????? document.getElementById('div11_pee_cn').style.top = (this.docHeight - parseInt(document.getElementById('div11_pee_cn').offsetHeight, 10)) + parseInt(this.bodyScrollTop, 10) + 0 + 'px';
??????????? document.getElementById('div11_pee_cn').style.left = (this.docWidth - parseInt(document.getElementById('div11_pee_cn').offsetWidth, 10)) + parseInt(this.bodyScrollLeft, 10) - 1 + 'px';
??????????? //this.element.style.top = (this.docHeight - parseInt(this.element.offsetHeight, 10)) + parseInt(this.bodyScrollTop, 10) + 0 + 'px';
??????????? //this.element.style.left = (this.docWidth - parseInt(this.element.offsetWidth, 10)) + parseInt(this.bodyScrollLeft, 10) - 1 + 'px';
??????? }
??? });
??? 
??? f.start();
??? drawCloseBtn();
??? 
??? function drawCloseBtn() {
??????? var btn_close = document.getElementById("pee_close_btn");
??????? btn_close.onclick = closeDivChina_ads_Frm;
??????? btn_close.target = "_self";
??? }
??? function closeDivChina_ads_Frm() {
??????? document.getElementById('div11_pee_cn').style.visibility = 'hidden';
??? }
</script>
?
總結
以上是生活随笔為你收集整理的广告代码(弹窗和富媒体)的全部內容,希望文章能夠幫你解決所遇到的問題。
 
                            
                        - 上一篇: 广告系统架构
- 下一篇: vue.js毕业设计,基于vue.js前
