JS漂浮廣告代碼,圖片飄動(dòng),響應(yīng)鼠標(biāo)停止。此類特效在前幾年的網(wǎng)頁(yè)中使用比較多,到了現(xiàn)在使用最多的就是右下角廣告和對(duì)聯(lián)廣告了。但是漂浮廣告代碼也是有他的好處的,點(diǎn)擊率比較高,既然來(lái)到網(wǎng)了,推薦您瞧瞧。
演示:
<html><head><title>漂浮廣告代碼</title></head><body><div id="img" style="position:absolute;z-index=99;"><a href="http://www.vxbq.cn"><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;">如不能顯示效果,請(qǐng)按Ctrl+F5刷新本頁(yè),更多網(wǎng)頁(yè)代碼:<a href='http://www.vxbq.cn/' target='_blank'>http://www.vxbq.cn/</a></div>提示:可修改后代碼再運(yùn)行!
上一篇 DIV+CSS技術(shù):網(wǎng)站改版及SEO優(yōu)化首選
下一篇 草根站長(zhǎng)創(chuàng)業(yè)面面觀 到底怎樣才能成功?
程序員人生,我編程,我富裕,記住wfuyu網(wǎng),php教程,php學(xué)習(xí),php手冊(cè),CMS模版制作
聲明:本站大部分內(nèi)容是作者原創(chuàng),少部分收集于互聯(lián)網(wǎng)供大家一起學(xué)習(xí),原版權(quán)很多不明,如有侵權(quán)請(qǐng)聯(lián)系本站,謝謝!
粵ICP備14040726號(hào)-1?? 2015-2020 程序員人生 版權(quán)所有