帮我这个浮动广告加个关闭按钮代码(代码如下)

你看下我做的www.beauty511.com现在我想要有一个一点就可以关闭的功能,请高手帮帮忙,感激不尽!!<divid="img"style="position:ab... 你看下我做的www.beauty511.com
现在我想要有一个一点就可以关闭的功能,请高手帮帮忙,感激不尽!!
<div id="img" style="position:absolute;">
<a href="http://www.beauty511.com/index.php?main_page=featured_products/"; target="_blank">
<img src="http://www.beauty511.com/images/guanggao/chuxiao.gif"; border="0"></a>
</div>

<SCRIPT LANGUAGE="JavaScript">
<!--
var xPos = 20;
var yPos = document.body.clientHeight;
var step = 1;
var delay = 30;
var height = 0;
var Hoffset = 0;
var Woffset = 0;
var yon = 0;
var xon = 0;
var pause = true;
var interval;
img.style.top = yPos;
function changePos() {
width = document.body.clientWidth;
height = document.body.clientHeight;
Hoffset = img.offsetHeight;
Woffset = img.offsetWidth;
img.style.left = xPos + document.body.scrollLeft;
img.style.top = yPos + document.body.scrollTop;
if (yon) {
yPos = yPos + step;
}
else {
yPos = yPos - step;
}
if (yPos < 0) {
yon = 1;
yPos = 0;
}
if (yPos >= (height - Hoffset)) {
yon = 0;
yPos = (height - Hoffset);
}
if (xon) {
xPos = xPos + step;
}
else {
xPos = xPos - step;
}
if (xPos < 0) {
xon = 1;
xPos = 0;
}
if (xPos >= (width - Woffset)) {
xon = 0;
xPos = (width - Woffset);
}
}
function www_helpor_net() {
img.visibility = "visible";
interval = setInterval('changePos()', delay);
}
www_helpor_net();
//For more,visit:www.helpor.net
-->
on (release) {
fscommand("quit",true)
}

</script>
展开
 我来答
创作者uhBIrGlXnX
推荐于2016-08-04 · TA获得超过1352个赞
知道小有建树答主
回答量:2369
采纳率:0%
帮助的人:1158万
展开全部
<div id="adver"><a href="http://www.51reward.com/index.php?

mod=about&item=trainingclass" target="_blank"><img border="0"

src="http://www.51reward.com/appdata/upload/201003/7b72c9f8aa766b4382c462b0

66634de1.jpg"></a></div>

<div id="adver1"><a href="http://www.51reward.com/index.php?mod=about&act=default&item=CommissionReward" target="_blank"><img border="0" src="http://www.51reward.com/appdata/upload/201003/e4595def026290b01f29ead262c5c79b.jpg"></a></div>

<script type="text/javascript">
<!--
//公共脚本文件 main.js
function addEvent(obj,evtType,func,cap){
cap=cap||false;
if(obj.addEventListener){
obj.addEventListener(evtType,func,cap);
return true;
}else if(obj.attachEvent){
if(cap){
obj.setCapture();
return true;
}else{
return obj.attachEvent("on" + evtType,func);
}
}else{
return false;
}
}
function removeEvent(obj,evtType,func,cap){
cap=cap||false;
if(obj.removeEventListener){
obj.removeEventListener(evtType,func,cap);
return true;
}else if(obj.detachEvent){
if(cap){
obj.releaseCapture();
return true;
}else{
return obj.detachEvent("on" + evtType,func);
}
}else{
return false;
}
}
function getPageScroll(){
var xScroll,yScroll;
if (self.pageXOffset) {
xScroll = self.pageXOffset;
} else if (document.documentElement &&

document.documentElement.scrollLeft){
xScroll = document.documentElement.scrollLeft;
} else if (document.body) {
xScroll = document.body.scrollLeft;
}
if (self.pageYOffset) {
yScroll = self.pageYOffset;
} else if (document.documentElement && document.documentElement.scrollTop){
yScroll = document.documentElement.scrollTop;
} else if (document.body) {
yScroll = document.body.scrollTop;
}
arrayPageScroll = new Array(xScroll,yScroll);
return arrayPageScroll;
}
function GetPageSize(){
var xScroll, yScroll;
if (window.innerHeight && window.scrollMaxY) {
xScroll = document.body.scrollWidth;
yScroll = window.innerHeight + window.scrollMaxY;
} else if (document.body.scrollHeight > document.body.offsetHeight){
xScroll = document.body.scrollWidth;
yScroll = document.body.scrollHeight;
} else {
xScroll = document.body.offsetWidth;
yScroll = document.body.offsetHeight;
}
var windowWidth, windowHeight;
if (self.innerHeight) {
windowWidth = self.innerWidth;
windowHeight = self.innerHeight;
} else if (document.documentElement &&

document.documentElement.clientHeight) {
windowWidth = document.documentElement.clientWidth;
windowHeight = document.documentElement.clientHeight;
} else if (document.body) {
windowWidth = document.body.clientWidth;
windowHeight = document.body.clientHeight;
}
if(yScroll < windowHeight){
pageHeight = windowHeight;
} else {
pageHeight = yScroll;
}
if(xScroll < windowWidth){
pageWidth = windowWidth;
} else {
pageWidth = xScroll;
}
arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight)
return arrayPageSize;
}

var AdMoveConfig=new Object();
AdMoveConfig.IsInitialized=false;
AdMoveConfig.AdCount=0;
AdMoveConfig.ScrollX=0;
AdMoveConfig.ScrollY=0;
AdMoveConfig.MoveWidth=0;
AdMoveConfig.MoveHeight=0;
AdMoveConfig.Resize=function(){
var winsize=GetPageSize();
AdMoveConfig.MoveWidth=winsize[2];
AdMoveConfig.MoveHeight=winsize[3];
AdMoveConfig.Scroll();
}
AdMoveConfig.Scroll=function(){
var winscroll=getPageScroll();
AdMoveConfig.ScrollX=winscroll[0];
AdMoveConfig.ScrollY=winscroll[1];
}
addEvent(window,"resize",AdMoveConfig.Resize);
addEvent(window,"scroll",AdMoveConfig.Scroll);
function AdMove(id,addCloseButton){
if(!AdMoveConfig.IsInitialized){
AdMoveConfig.Resize();
AdMoveConfig.IsInitialized=true;
}
AdMoveConfig.AdCount++;
var obj=document.getElementById(id);
obj.style.position="absolute";
var W=AdMoveConfig.MoveWidth-obj.offsetWidth;
var H=AdMoveConfig.MoveHeight-obj.offsetHeight;
var x = W*Math.random(),y = H*Math.random();
var rad=(Math.random()+1)*Math.PI/6;
var kx=Math.sin(rad),ky=Math.cos(rad);
var dirx = (Math.random()<0.5?1:-1), diry = (Math.random()<0.5?1:-1);
var step = 1;
var interval;
if(addCloseButton){
var closebtn=document.createElement("div");
obj.appendChild(closebtn);
closebtn.style.position="absolute";
closebtn.style.top="1px";
closebtn.style.left=(obj.offsetWidth-28) + "px";
closebtn.style.width="24px";
closebtn.style.height="12px";
closebtn.style.borderStyle="solid";
closebtn.style.borderWidth="1px";
closebtn.style.borderColor="#000";
closebtn.style.backgroundColor="#fff";
closebtn.style.fontSize="12px";
closebtn.style.color="#000";
closebtn.style.cursor="pointer";
closebtn.innerHTML="关闭";
closebtn.onclick=function(){
obj.style.display="none";
clearInterval(interval);
closebtn.onclick=null;
obj.onmouseover=null;
obj.onmouseout=null;
obj.MoveHandler=null;
AdMoveConfig.AdCount--;
if(AdMoveConfig.AdCount<=0){
removeEvent(window,"resize",AdMoveConfig.Resize);
removeEvent(window,"scroll",AdMoveConfig.Scroll);
AdMoveConfig.Resize=null;
AdMoveConfig.Scroll=null;
AdMoveConfig=null;
}
}
}
obj.MoveHandler=function(){
obj.style.left = (x + AdMoveConfig.ScrollX) + "px";
obj.style.top = (y + AdMoveConfig.ScrollY) + "px";
rad=(Math.random()+1)*Math.PI/6;
W=AdMoveConfig.MoveWidth-obj.offsetWidth;
H=AdMoveConfig.MoveHeight-obj.offsetHeight;
x = 0;
y = y + step*ky*diry;
if (y < 0){diry = 1;y = 0;kx=Math.sin(rad);ky=Math.cos(rad);}
if (y > H){diry = -1;y = H;kx=Math.sin(rad);ky=Math.cos(rad);}
}
this.SetLocation=function(vx,vy){x=vx;y=vy;}
this.SetDirection=function(vx,vy){dirx=vx;diry=vy;}
this.Run=function(){
var delay = 10;
interval=setInterval(obj.MoveHandler,delay);
obj.onmouseover=function(){clearInterval(interval);}
obj.onmouseout=function(){interval=setInterval(obj.MoveHandler, delay);}
}
}
//-->
</script>
</head>
<body>

<script type="text/javascript">
<!--
var ad1=new AdMove("adver",true);
ad1.Run();
var ad2=new AdMove("adver1",true);
ad2.Run();
//-->
</script>
本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式