JS漂浮廣告代碼,圖片飄動,響應鼠標停止。此類特效在前幾年的網頁中使用比較多,到了現在使用最多的就是右下角廣告和對聯廣告了。但是漂浮廣告代碼也是有他的好處的,點擊率比較高,既然來到網了,推薦您瞧瞧。
演示:
<html><head><title>漂浮廣告代碼</title></head><body><div id="img" style="position:absolute;z-index=99;"><a href="http://www.jyygyx.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.jyygyx.com/' target='_blank'>http://www.jyygyx.com/</a></div>提示:可修改后代碼再運行!
上一篇 DIV+CSS技術:網站改版及SEO優化首選
下一篇 草根站長創業面面觀 到底怎樣才能成功?
程序員人生,我編程,我富裕,記住wfuyu網,php教程,php學習,php手冊,CMS模版制作
聲明:本站大部分內容是作者原創,少部分收集于互聯網供大家一起學習,原版權很多不明,如有侵權請聯系本站,謝謝!
粵ICP備14040726號-1?? 2015-2020 程序員人生 版權所有