熱點推薦:
您现在的位置: 電腦知識網 >> 編程 >> Java編程 >> JSP教程 >> 正文

JavaScript制作會反彈的浮動圖片

2013-11-15 11:40:37  來源: JSP教程 
現在網上流行會彈來彈去的浮動圖片想給自己的網頁也加上一個嗎?其實很簡單把下面這段代碼加到網頁的之間然後把圖片換成你中意的就OK啦!

  到這裡下載示例代碼

< div id=img >
< a _blank>
< img src=eschoolbuttongif >
< /a>
< /div>

< SCRIPT LANGUAGE=JavaScript>
< ! Begin
var xPos = ;
var yPos = documentbodyclientHeight;
var step = ;
var delay = ;
var height = ;
var Hoffset = ;
var Woffset = ;
var yon = ;
var xon = ;
var pause = true;
var interval;
imgstyletop = yPos;
function changePos() {
width = documentbodyclientWidth;
height = documentbodyclientHeight;
Hoffset = imgoffsetHeight;
Woffset = imgoffsetWidth;
imgstyleleft = xPos + documentbodyscrollLeft;
imgstyletop = yPos + documentbodyscrollTop;
if (yon) {
yPos = yPos + step;
}
else {
yPos = yPos step;
}
if (yPos < ) {
yon = ;
yPos = ;
}
if (yPos >= (height Hoffset)) {
yon = ;
yPos = (height Hoffset);
}
if (xon) {
xPos = xPos + step;
}
else {
xPos = xPos step;
}
if (xPos < ) {
xon = ;
xPos = ;
}
if (xPos >= (width Woffset)) {
xon = ;
xPos = (width Woffset);
}
}
function start() {
imgvisibility = visible;
interval = setInterval(´changePos()´ delay);
}
start();
// End >
< /script >
From:http://tw.wingwit.com/Article/program/Java/JSP/201311/19424.html
    推薦文章
    Copyright © 2005-2013 電腦知識網 Computer Knowledge   All rights reserved.