打印本文 打印本文 关闭窗口 关闭窗口
飘浮广告的显示脚本类(VBS,JS双版)
作者:武汉SEO闵涛  文章来源:敏韬网  点击数1832  更新时间:2009/4/23 11:30:56  文章录入:mintao  责任编辑:mintao
return; 
objDiv.style.pixelLeft = iLeft + document.body.scrollLeft; 
objDiv.style.pixelTop = iTop + document.body.scrollTop; 
if(iRnd>98){leftFlag=!leftFlag;} 
iRnd=Math.round(Math.random()*100); 
if(iRnd>99){topFlag=!topFlag;} 
if(leftFlag){ 
iLeft=iLeft+leftStep*Math.random(); 
}else{ 
iLeft=iLeft-leftStep*Math.random(); 

if(topFlag){ 
iTop=iTop+topStep*Math.random(); 
}else{ 
iTop=iTop-topStep*Math.random(); 

if(iLeft<0){ 
iLeft=0; 
leftFlag=true; 

else if(iLeft>width-offWidth){ 
iLeft=width-offWidth; 
leftFlag=false; 

if(iTop<0){ 
iTop=0; 
topFlag=true; 

else if(iTop>height-offHeight){ 
iTop=height-offHeight; 
topFlag=false; 


file://定时移动广告的图片 
function startTimer(){ 
if(objName=="")return; 
file://alert(objName+".floatScroll();"); 
file://inter=setInterval(objName+".floatScroll()",delay); 

file://显示图片的HTML代码 
function showImageHtml(adImgSrc,adHref,adTitle){ 
var sWidth,sHeight; 
if(imageWidth<5){ 
sWidth=""; 
}else{ 
sWidth=" width='"+imageWidth+"'"; 

if(imageHeight<5){ 
sHeight=""; 
}else{ 
sHeight=" height='"+imageHeight+"'"; 

document.write("<div id='img"+divID+"' style='position:absolute;'>"); 
document.write("<a href='"+adHref+"' target='_blank' title='"+adTitle+"'>"); 
document.write("<img src='"+adImgSrc+"' border='0'"+sWidth+sHeight+">"); 
document.write("</a></div>"); 

file://显示Flash文件的HTML代码 
function showFlashHtml(adImgSrc,adHref,adTitle){ 
var sWidth,sHeight; 
if(imageWidth<5){ 
sWidth=" width='80'"; 
}else{ 
sWidth=" width='"+imageWidth+"'"; 

if(imageHeight<5){ 
sHeight=" height='80'"; 
}else{ 
sHeight=" height='"+imageHeight+"'"; 

document.write("<div id='img"+divID+"' style='position:absolute;'>"); 
document.write("<a href='"+adHref+"' target='_blank' title='"+adTitle+"'>"); 
document.write("<object codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0'"+sWidth+sHeight+" align='middle'>"); 
document.write("<param name='movie' value='"+adImgSrc+"'>"); 
document.write("<param name='quality' value='high'>"); 
document.write("<embed src='"+adImgSrc+"'"+sWidth+sHeight+" quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash'></embed></object>"); 
document.write("</a></div>"); 



示例代码(包括两种脚本的使用):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> 漂浮广告显示脚本类演示 </TITLE>
</HEAD>

<BODY>
<!--VBS脚本版的广告显示类示例程序-->
<script LANGUAGE="vbscript" src="Advervbs.vbs"></script>
<script LANGUAGE="vbscript">
Dim Adver,Adver1
Set Adver=New AdverClass
Adver.ObjName="Adver"
Adver.DivID=20
Adver.PrintHtml "img.gif","http://www.chinese.bj.cn/","这是什么"
Set Adver1=New AdverClass
Adver1.ObjName="Adver1"
Adver1.ImgType=1
Adver1.ImageWidth=299
Adver1.ImageHeight=87
Adver1.PrintHtml "http://edu.qq.com/flash/moto-button.swf","http://www.chinese.bj.cn/' target="_blank" >http://edu.qq.com/flash/moto-button.swf","http://www.chinese.bj.cn/","这是什么"
</script>
<!--JS脚本版的广告显示类示例程序-->
<script LANGUAGE="Javascript" src="AdverClass.js"></script>
<script LANGUAGE="Javascript">
var adver=new adverClass();
adver.setObjName("adver");
adver.setDivID(1);
adver.setImageType(1);
adver.setImagePX(299,87);
adver.showAdver("http://edu.qq.com/flash/moto-button.swf","http://www.chinese.bj.cn/' target="_blank" >http://edu.qq.com/flash/moto-button.swf","http://www.chinese.bj.cn/","这是什么");
var adver1=new adverClass();
adver1.showAdver("img.gif","http://www.chinese.bj.cn/","这是什么");
setTimer();
function setTimer(){
adver.floatScroll();
adver1.floatScroll();
setTimeout("setTimer()",80);
}
</script>
</BODY>
</HTML>

上一页  [1] [2] 

打印本文 打印本文 关闭窗口 关闭窗口