国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 編程 > JavaScript > 正文

Javascript實(shí)現(xiàn)帶關(guān)閉按鈕的網(wǎng)頁(yè)漂浮廣告代碼

2019-11-20 21:16:09
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友
復(fù)制代碼 代碼如下:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>帶關(guān)閉按鈕的網(wǎng)頁(yè)漂浮廣告代碼</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">
<a href="#" target="_blank"><img border="0" src="圖片路徑" onload="return imgzoom(this,600);" onclick="javascript:window.open(this.src);" style="cursor:pointer;"/></a>
<span style="CURSOR:hand;color:red;font-weight:bold" onclick="clearInterval(interval);img.style.visibility = 'hidden'">X</span>
</div>
<script language=javascript src=ff.js>

</script>
</body>
</html>

ff.js代碼
復(fù)制代碼 代碼如下:

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 start() {
img.style.visibility = "visible";
interval = setInterval('changePos()', delay);
}
start();
發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 汕头市| 远安县| 乌苏市| 瑞丽市| 中江县| 舒城县| 乐清市| 玉龙| 广宁县| 五峰| 阿拉善右旗| 宜春市| 曲靖市| 阿合奇县| 大兴区| 葵青区| 右玉县| 吴旗县| 海南省| 潜山县| 商都县| 从江县| 富裕县| 黑水县| 井陉县| 昂仁县| 凌海市| 阜南县| 宁城县| 孟津县| 文山县| 尼木县| 铜鼓县| 东乌珠穆沁旗| 北宁市| 广昌县| 明光市| 明水县| 新河县| 象山县| 沙雅县|