2边浮动广告
把下面js放在一个ad.js的文件.直接<script language="javascript" src="ad.js"></script>就可以了
//
1
var type=2; //广告显示的类别,1图片,2falsh
var left_ads=""; //左边广告
var right_ads=""; //右边广告
if(type==1){ //广告为图片
left_ads="<a href='#' target='_blank'><img src='left.gif' width='95' height='300' border='0' alt='欢迎访问本站'></a>"
right_ads="<a href='#' target='_blank'><img src='rig.gif' width='95' height='300' border='0' alt='欢迎访问本站'></a>"
}
else if(type==2){ //广告为flash
left_ads=reloadfalsh('300','90','swf/ad_right.swf','yes');
right_ads=reloadfalsh('300','90','swf/ad_right.swf','yes');
}
suspendcode="<DIV id=lovexin1 style='Z-INDEX: 10; LEFT: -0px; POSITION: absolute; TOP: 100px; width: 90; height: 203px;'>"+left_ads+"</DIV>"
document.write(suspendcode);
suspendcode="<DIV id=lovexin2 style='Z-INDEX: 10; right: 0px; POSITION: absolute; TOP: 100px; width: 90; height: 203px;'>"+right_ads+"</DIV>"
document.write(suspendcode);
lastScrollY=0;
function heartBeat(){
diffY=document.body.scrollTop;
percent=.3*(diffY-lastScrollY);
if(percent>0)percent=Math.ceil(percent);
else percent=Math.floor(percent);
document.all.lovexin1.style.pixelTop+=percent;
document.all.lovexin2.style.pixelTop+=percent;
lastScrollY=lastScrollY+percent;
}
//关闭浮动广告
function hide()
{
lovexin1.style.visibility="hidden";
lovexin2.style.visibility="hidden";
}
//去掉flash的虚线框开始
function reloadfalsh(height,width,url,transparent){
var falshbl="";
falshbl+="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0' width='"+width+"' height='"+height+"'>/n";
falshbl+="<param name='movie' value='"+url+"' />/n";
falshbl+="<param name='quality' value='high' />/n";
if(transparent=="yes"){
falshbl+="<param name='wmode' value='transparent' />/n";
}
falshbl+="<embed src='"+url+"' quality='high' pluginspage='http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='"+width+"' height='"+height+"'></embed>/n";
falshbl+="</object>/n";
return falshbl;
}
//去掉flash的虚线框结束
window.setInterval("heartBeat()",1);
把下面js放在一个ad.js的文件.直接<script language="javascript" src="ad.js"></script>就可以了


var left_ads=""; //左边广告
var right_ads=""; //右边广告
if(type==1){ //广告为图片
left_ads="<a href='#' target='_blank'><img src='left.gif' width='95' height='300' border='0' alt='欢迎访问本站'></a>"
right_ads="<a href='#' target='_blank'><img src='rig.gif' width='95' height='300' border='0' alt='欢迎访问本站'></a>"
}
else if(type==2){ //广告为flash
left_ads=reloadfalsh('300','90','swf/ad_right.swf','yes');
right_ads=reloadfalsh('300','90','swf/ad_right.swf','yes');
}
suspendcode="<DIV id=lovexin1 style='Z-INDEX: 10; LEFT: -0px; POSITION: absolute; TOP: 100px; width: 90; height: 203px;'>"+left_ads+"</DIV>"
document.write(suspendcode);
suspendcode="<DIV id=lovexin2 style='Z-INDEX: 10; right: 0px; POSITION: absolute; TOP: 100px; width: 90; height: 203px;'>"+right_ads+"</DIV>"
document.write(suspendcode);
lastScrollY=0;
function heartBeat(){
diffY=document.body.scrollTop;
percent=.3*(diffY-lastScrollY);
if(percent>0)percent=Math.ceil(percent);
else percent=Math.floor(percent);
document.all.lovexin1.style.pixelTop+=percent;
document.all.lovexin2.style.pixelTop+=percent;
lastScrollY=lastScrollY+percent;
}
//关闭浮动广告
function hide()
{
lovexin1.style.visibility="hidden";
lovexin2.style.visibility="hidden";
}
//去掉flash的虚线框开始
function reloadfalsh(height,width,url,transparent){
var falshbl="";
falshbl+="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0' width='"+width+"' height='"+height+"'>/n";
falshbl+="<param name='movie' value='"+url+"' />/n";
falshbl+="<param name='quality' value='high' />/n";
if(transparent=="yes"){
falshbl+="<param name='wmode' value='transparent' />/n";
}
falshbl+="<embed src='"+url+"' quality='high' pluginspage='http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash' type='application/x-shockwave-flash' width='"+width+"' height='"+height+"'></embed>/n";
falshbl+="</object>/n";
return falshbl;
}
//去掉flash的虚线框结束
window.setInterval("heartBeat()",1);