JS漂浮广告代码,图片飘动,响应鼠标停止。此类特效在前几年的网页中使用比较多,到了现在使用最多的就是右下角广告和对联广告了。但是漂浮广告代码也是有他的好处的,点击率比较高,既然来到网了,推荐您瞧瞧。
演示:
<html><head><title>漂浮广告代码</title></head><body><div id="img" style="position:absolute;z-index=99;"><a href="http://www.wfuyu.com"><img src="/images/logo.gif" border="0" alt='img'></a></div><SCRIPT LANGUAGE="JavaScript"><!-- Beginvar xPos = document.body.clientWidth-20;var yPos = document.body.clientHeight/2;var step = 1;var delay = 5;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.visibility = "visible";interval = setInterval('changePos()', delay);}start();img.onmouseover = function() {clearInterval(interval);interval = null;}img.onmouseout = function() {interval = setInterval('changePos()', delay);}// End --></script></body></html><div style="text-align:center;margin:30px 0 0 0;"><hr style="color:#999;height:1px;">如不能显示效果,请按Ctrl+F5刷新本页,更多网页代码:<a href='http://www.wfuyu.com/' target='_blank'>http://www.wfuyu.com/</a></div>提示:可修改后代码再运行!
上一篇 DIV+CSS技术:网站改版及SEO优化首选
下一篇 草根站长创业面面观 到底怎样才能成功?