复制代码代码如下:
<!-首页图片漂浮开始->
<type script = "text/javascript" bahasa = "javascript">
fungsi addevent (obj, evttype, func, cap) {
cap = cap || PALSU;
if (obj.addeventListener) {
obj.addeventlistener (evttype, func, cap);
Kembali Benar;
} lain jika (obj.attachevent) {
if (cap) {
obj.setCapture ();
Kembali Benar;
} kalau tidak {
kembalikan obj.attachevent ("on" + evttype, func);
}
} kalau tidak {
mengembalikan false;
}
}
function getPagesCroll () {
var xscroll, yscroll;
if (self.pagexoffset) {
xscroll = self.pagexoffset;
} else if (document.documentelement && document.documentelement.scrollleft) {
xscroll = document.documentelement.scrollleft;
} lain if (document.body) {
xscroll = document.body.scrollleft;
}
if (self.pageyoffset) {
yscroll = self.pageyoffset;
} else if (document.documentelement && document.documentelement.scrolltop) {
yscroll = document.documentelement.scrolltop;
} lain if (document.body) {
yscroll = document.body.scrolltop;
}
arraypagescroll = array baru (xscroll, yscroll);
return arraypagescroll;
}
function getPageSize () {
var xscroll, yscroll;
if (window.innerheight && window.scrollmaxy) {
xscroll = document.body.scrollwidth;
yscroll = window.innerheight + window.scrollmaxy;
} else if (document.body.scrollheight> document.body.offsetheight) {
xscroll = document.body.scrollwidth;
yscroll = document.body.scrollheight;
} kalau tidak {
xscroll = document.body.offsetWidth;
yscroll = document.body.offsetHeight;
}
var windowwidth, windowheight;
if (self.innerheight) {
windowwidth = self.innerwidth;
windowheight = self.innerheight;
} else if (document.documentElement && document.documentelement.clientHeight) {
windowwidth = document.documentelement.clientwidth;
windowheight = document.documentelement.clientHeight;
} lain if (document.body) {
windowwidth = document.body.clientwidth;
windowheight = document.body.clientHeight;
}
if (yscroll <windowheight) {
PageHeight = WindowHeight;
} kalau tidak {
pageHeight = yscroll;
}
if (xscroll <windowwidth) {
pagewidth = windowwidth;
} kalau tidak {
pagewidth = xscroll;
}
arraypagesize = array baru (pagewidth, pageHeight, windowwidth, windowheight)
return arraypagesize;
}
var advoveconfig = objek baru ();
Admoveconfig.isinitialized = false;
Admoveconfig.scrollx = 0;
Admoveconfig.scrolly = 0;
Admoveconfig.movewidth = 0;
Admoveconfig.moveHeight = 0;
Admoveconfig.resize = function () {
var winsize = getPageSize ();
Admoveconfig.movewidth = winsize [2];
Admoveconfig.moveHeight = winsize [3];
Admoveconfig.scroll ();
}
Admoveconfig.scroll = function () {
var winscroll = getPagesCroll ();
Admoveconfig.scrollx = winscroll [0];
Admoveconfig.scrolly = winscroll [1];
}
addEvent (window, "ubah ukuran", admoveconfig.resize);
addEvent (window, "gulir", admoveconfig.scroll);
function adminve (id) {
if (! admoveconfig.isinitialized) {
Admoveconfig.ressize ();
Admoveconfig.isinitialized = true;
}
var obj = document.geteLementById (id);
obj.style.position = "absolute";
var w = admoveconfig.movewidth - obj.offsetwidth;
var h = admoveconfig.moveHeight - obj.offsetheight;
var x = w * math.random (), y = h * math.random ();
var rad = (math.random () + 1) * math.pi / 6;
var kx = math.sin (rad), ky = math.cos (rad);
var dirx = (math.random () <0,5? 1: -1), diry = (math.random () <0,5? 1: -1);
var step = 1;
interval var;
this.setLocation = function (vx, vy) {x = vx; y = vy; }
this.setDirection = function (vx, vy) {dirx = vx; diry = vy; }
obj.custommethod = function () {
obj.style.left = (x + admoveconfig.scrollx) + "px";
obj.style.top = (y + admoveconfig.scrolly) + "px";
rad = (math.random () + 1) * math.pi / 6;
W = admoveconfig.movewidth - obj.offsetwidth;
H = admoveconfig.moveHeight - obj.offsetheight;
x = x + langkah * kx * dirx;
if (x <0) {dirx = 1; x = 0; kx = math.sin (rad); ky = math.cos (rad); }
if (x> w) {dirx = -1; x = w; kx = math.sin (rad); ky = math.cos (rad); }
y = y + langkah * ky * diry;
if (y <0) {diry = 1; y = 0; kx = math.sin (rad); ky = math.cos (rad); }
if (y> h) {diry = -1; y = h; kx = math.sin (rad); ky = math.cos (rad); }
}
this.run = function () {
var delay = 10;
interval = setInterval (obj.custommethod, tunda);
obj.onmouseover = function () {clearInterval (interval); }
obj.onmouseout = function () {interval = setInterval (obj.custommethod, delay); }
}
}
</script>
<!-漂浮开始->
<Div ID = AD2 style = "z-index: 5; Posisi: Relative">
<a href = 'Policehtk.aspx' target = '_ blank'> <img src = "gambar/fudong/fudong.jpg"> </a> <br> <a href = "#" onclick = "document.getElementById ('ad2'). style.display = 'tidak ada'> <iMg = 0 sing = 0 sing =/fies = fies = 0/fies = fies = IMG = 0 tidak ada. /> </a>
<!-漂浮结束->
</div>
<type script = "text/javascript" bahasa = "javascript">
var AD2 = ADMOVE baru ("AD2");
ad2.run ();
// 多组漂浮
</script>
<!-首页图片漂浮结束->