// 显示广告的函数 (function showads1() { var ads = $('body').attr('ads'); var url='/manager.advertjson.list.phtml'; if (ads != undefined && ads != "") { $.post(url,{'adver':ads},function(result){ var arr = $.parsejson(result); for(var i=0;i 0) { if (top + ad.offsetheight >= h) { top = (h - ad.offsetheight) * 2 - top; _y = -_y; } } else { if (top <= 0) { top = -top; _y = -_y; } } ad.style.top = top + 'px'; left += _x; if (_x > 0) { if (left + ad.offsetwidth >= w) { left = (w - ad.offsetwidth) * 2 - left; _x = -_x; } } else { if (left <= 0) { left = -left; _x = -_x; } } ad.style.left = left + 'px'; } function swimf(b) { clearinterval(timer); if (b) timer = setinterval(f, 40); } function swimgo() { swimf(1); } function swimstop() { swimf(0); } return fudong; }(); ////////////////////////////浮动广告////////////////////////// ////////////////////////////背投广告////////////////////////// var beitou = function() { var ad, closed = false; function beitou(ads) { var d = document.createelement('div'); d.appendchild(ad_head(beitou_close)); d.appendchild(ad_body(ads.content)); document.body.insertbefore(ad = d, document.body.firstchild); settimeout(beitou_close, 3000); } function beitou_close() { if (closed) return; closed = true; var t, h = ad.offsetheight; var v = 2; var a = 2; function f() { h -= v; if (h <= 0) { clearinterval(t); ad.parentnode.removechild(ad); ad = null; return; } ad.style.height = h + 'px'; v += a; } ad.style.overflow = 'hidden'; t = setinterval(f, 10); } return beitou; }(); ////////////////////////////背投广告////////////////////////// ////////////////////////////固定广告////////////////////////// var guding = function(){ var ad; function guding_close(){ $(ad).empty(); } function guding(ads){ var left = ads.site.split(',')[0]; var top = ads.site.split(',')[1]; var d = document.createelement('div'); d.style.position='fixed'; d.style.left=left+'px'; d.style.top=top+'px'; d.appendchild(ad_head(guding_close)); d.appendchild(ad_body(ads.content)); document.body.appendchild(ad = d); } return guding; }(); ////////////////////////////固定广告////////////////////////// ////////////////////////////折叠广告////////////////////////// var zhedie = function(){ var ads; var expanded=true; //折叠广告在右侧的折叠事件 function zhedie_expanded_right(){ if (expanded) { $('#ads_zhedie').animate({right:'0'},500); $('#ads_head_a').attr('src','/image/mini_close.png'); }else { $('#ads_zhedie').animate({right:'-260px'},500); $('#ads_head_a').attr('src','/image/mini_open.png'); } expanded=!expanded; } //折叠广告在左侧的折叠事件 function zhedie_expanded_left(){ if (expanded) { $('#ads_zhedie').animate({left:'0'},500); $('#ads_head_a').attr('src','/image/mini_open.png'); }else { $('#ads_zhedie').animate({left:'-260px'},500); $('#ads_head_a').attr('src','/image/mini_close.png'); } expanded=!expanded; } function zhedie(ads){ var ads_site = ads.site; if(ads_site=='left'){ left(ads); }else{ right(ads); } } function left(ads){ //最大div var ad = document.createelement('div'); ad.setattribute('id','ads_zhedie'); ad.style.position='fixed'; ad.style.width='290px'; ad.style.left='-260px'; ad.style.bottom='120px'; ad.style.zindex = '1000'; var d = document.createelement('div'); d.style.width='290px'; d.style.minheight='220px'; d.style.position='relative'; //广告标题竖列显示 var title=''; //string转数组 var title_arr = ads.title.split(''); for(var i=0;i'; } var d_head = document.createelement('div'); d_head.setattribute('id','ads_head'); d_head.style.width='30px'; d_head.style.float='right'; d_head.style.backgroundcolor='#297ad0'; d_head.style.color='#ffffff'; d_head.style.cursor = 'pointer'; d_head.onclick=zhedie_expanded_left; var d_head_a = document.createelement('img'); d_head_a.setattribute('id','ads_head_a'); d_head_a.style.position='relative'; d_head_a.style.float='right'; d_head_a.src='/image/mini_close.png'; //d_head_a.innerhtml='  '; var d_head_span = document.createelement('span'); d_head_span.style.display='block'; d_head_span.style.width='100%'; d_head_span.style.textalign='center'; d_head_span.innerhtml=title; d_head.appendchild(d_head_a); d_head.appendchild(d_head_span); var d_body =document.createelement('div'); d_body.setattribute('id','ads_body'); d_body.style.bordercolor='#ccc'; d_body.style.bordertopwidth='1px'; d_body.style.borderbottomwidth='1px'; d_body.style.borderleftwidth='1px'; d_body.style.borderrightwidth='1px'; d_body.style.borderstyle='solid'; d_body.style.width='260px'; d_body.style.height='100%'; d_body.style.backgroundcolor='#ffffff'; d_body.style.float='left'; d_body.style.padding='10px'; d_body.innerhtml=ads.content; d.appendchild(d_head); d.appendchild(d_body); ad.appendchild(d); document.body.appendchild(ads = ad); } function right(ads){ var ad = document.createelement('div'); ad.setattribute('id','ads_zhedie'); ad.style.position='fixed'; ad.style.width='290px'; ad.style.right='-260px'; ad.style.bottom='120px'; ad.style.zindex = '1000'; var d = document.createelement('div'); d.style.width='290px'; d.style.minheight='220px'; d.style.position='relative'; var title=''; var title_arr = ads.title.split(''); for(var i=0;i'; } var d_head = document.createelement('div'); d_head.setattribute('id','ads_head'); d_head.style.width='30px'; d_head.style.float='left'; d_head.style.backgroundcolor='#297ad0'; d_head.style.color='#ffffff'; d_head.style.cursor = 'pointer'; d_head.onclick=zhedie_expanded_right; var d_head_a = document.createelement('img'); d_head_a.setattribute('id','ads_head_a'); d_head_a.style.position='relative'; d_head_a.style.float='left'; d_head_a.src='/image/mini_open.png'; //d_head_a.innerhtml='  '; var d_head_span = document.createelement('span'); d_head_span.style.display='block'; d_head_span.style.width='100%'; d_head_span.style.textalign='center'; d_head_span.innerhtml=title; d_head.appendchild(d_head_a); d_head.appendchild(d_head_span); var d_body =document.createelement('div'); d_body.setattribute('id','ads_body'); d_body.style.bordercolor='#ccc'; d_body.style.bordertopwidth='1px'; d_body.style.borderbottomwidth='1px'; d_body.style.borderleftwidth='1px'; d_body.style.borderrightwidth='1px'; d_body.style.borderstyle='solid'; d_body.style.width='260px'; d_body.style.height='100%'; d_body.style.backgroundcolor='#ffffff'; d_body.style.float='left'; d_body.style.padding='10px'; d_body.innerhtml=ads.content; d.appendchild(d_head); d.appendchild(d_body); ad.appendchild(d); document.body.appendchild(ads = ad); } return zhedie; }(); ////////////////////////////折叠广告//////////////////////////