JS带关闭按钮的网页漂浮广告代码

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>带关闭按钮的网页漂浮广告代码</title>
</head>
<body>
<div id="img" style="position: absolute; left: 311; top: 815;visibility :hidden;" onmouseover="clearInterval(interval)" onmouseout="interval = setInterval(‘changePos()‘, delay)" align="right">
<img border="0" src="https://static3.51cto.com/home/web/images/Flogo.png"  onclick="javascript:window.open("http://blog.51cto.com/viewpic.php?refimg=" + this.src);" style="cursor:pointer;"/>
<span style="CURSOR:hand;color:red;font-weight:bold" onclick="clearInterval(interval);img.style.visibility = ‘hidden‘">X</span>
</div>
<script language=javascript>
var xPos = 20;//from alixixi.com
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 start() {                    
img.style.visibility = "visible";                  
interval = setInterval(‘changePos()‘, delay);                    
}              
start();  
</script>
</body>
</html>
时间: 2024-08-01 15:03:33

JS带关闭按钮的网页漂浮广告代码的相关文章

常用网页漂浮广告代码

<body bgcolor="#F7F7F7"><!--图片漂浮广告代码开始--><div id="www_qpsh_com" style="position:absolute"><!--链接地址--><a href="http://www.balidaoyou.cn" _fcksavedurl="/" target="_blank"

超简单漂浮广告代码、网页漂浮广告代码、jQuery漂浮广告、div漂浮层

1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>Title</title> 6 <script type="text/javascript" src="jquery-1.8.3.min.js"></script> 7 &l

JavaScript浮动广告代码,容纯DIV/CSS对联漂浮广告代码,兼容性非常好的js右下角与漂浮广告代码

基于JavaScript代码实现随机漂浮图片广告,javascript图片广告 在网上有很多这样的代码,不过未必符合W3C标准,因为在头部加上<!DOCTYPE html>类似标签之后,漂浮效果就会失效,下面分享一个符合标准的漂浮代码,使需要的朋友免去大量改造代码的繁琐. 代码一: 代码如下: <!DOCTYPE html> <html> <head> <meta charset=" utf-8"> <meta name

网页特效”漂浮广告代码”来回跳动的

<div id="ad" style="position:absolute"><a href="http://www.scshlx.com/wayne173" target="_blank"><img src="http://www.hxlysw.com/images/adminlogo.gif" border="0"></a></d

Js弹性漂浮广告代码

<html><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>Js弹性漂浮广告代码</title></head><body><DIV id=img1 style="Z-INDEX: 100; LEFT: 2px; WIDTH: 59px; POSITIO

漂浮广告代码兼容ie、firefox,多个漂浮不冲突,调用只需两行代码

原文:漂浮广告代码兼容ie.firefox,多个漂浮不冲突,调用只需两行代码 将广告内容放在div中,设置一个id,然后用下面方法调用var adcls=new AdMove("div的id");adcls.Run();注意,在调用前要先引用Main.js和AdFloat.js,div也要在调用前写好,原因就不用说了吧或者也可以用下面方法,在页面加载完成时调用,就不用考虑位置了addEvent(window,"load",initad);function inita

JS漂浮广告代码

<html><head><title>漂浮广告</title><body><div id="codefans_net" style="position:absolute"><!--链接地址--><a href="#" target="_blank"><!--图片地址--><img src="/images

HTML网页漂浮广告原理js实现

<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <title></title> </head> <body> <style type="text/css"> #demo { width: 100px; height: 100px; position:absolut

经典的js物理弹性漂浮图片广告代码

比较经典通用的Js物理弹性漂浮广告代码,漂浮速度适中.大小适中,是最经典最标准的漂浮广告代码了,推荐给大家使用.不过漂浮广告在一个页面上最好不要放太多,否则很影响网站浏览体验,得不偿失. <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312" /> <title>经典的js物理弹性漂浮图片广告代码丨kiddy&l