复制代码代码如下:
<!-首页图片漂浮开始->
<script type = "text/javaScript" lenguaje = "javaScript">
función addEvent (obj, evttype, func, cap) {
Cap = Cap || FALSO;
if (obj.addeventListener) {
obj.addeventListener (evttype, func, cap);
devolver verdadero;
} else if (obj.attachevent) {
if (cap) {
obj.setCapture ();
devolver verdadero;
} demás {
regresar obj.attachevent ("on" + evttype, func);
}
} demás {
devolver falso;
}
}
función getPagescroll () {
var xscroll, yScroll;
if (self.pagexoffset) {
xscroll = self.pagexoffset;
} else if (document.documentelement && document.documentelement.scrollleft) {
xscroll = document.documentelement.scrollleft;
} else if (document.body) {
xscroll = document.body.scrollleft;
}
if (self.pageyoffset) {
yScroll = self.pageyOffset;
} else if (document.documentelement && document.documentelement.scrolltop) {
yscroll = document.documentelement.scrolltop;
} else if (document.body) {
yscroll = document.body.scrolltop;
}
ArrayPagesCroll = New Array (xscroll, yscroll);
return arraypagescroll;
}
función 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;
} demás {
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;
} else if (document.body) {
WindowWidth = document.body.clientWidth;
WindowHeight = document.body.clientheight;
}
if (yscroll <windowHeight) {
PageHeight = WindowHeight;
} demás {
PageHeight = yScroll;
}
if (xscroll <windowwidth) {
PageWidth = WindowWidth;
} demás {
PageWidth = xscroll;
}
ArrayPageSize = New Array (PageWidth, PageHeight, Windowwidth, WindowsHeight)
devolver ArrayPageSize;
}
var admoveconfig = new Object ();
Admoveconfig.isinitialized = false;
AMMOVECONFIG.SCROLLX = 0;
Admoveconfig.scrolly = 0;
AMMOVECONFIG.MOVEWIDTH = 0;
AMMOVECONFIG.MOVEHEIGHT = 0;
AMMOVECONFIG.RESIZE = function () {
var winsize = getPageSize ();
AMMOVECONFIG.MOVEWIDTH = WINSIZE [2];
Admoveconfig.moveHeight = Winsize [3];
AMMOVECONFIG.SCROLL ();
}
AMMOVECONFIG.Scroll = function () {
var winscroll = getPageScroll ();
AMMOVECONFIG.SCROLLX = winscroll [0];
Admoveconfig.scrolly = winscroll [1];
}
addEvent (ventana, "cambiar de tamaño", admoveconfig.resize);
addEvent (ventana, "desplazamiento", admoveconfig.scroll);
función admove (id) {
if (! Amoveconfig.isinitialized) {
Admoveconfig.resize ();
Admoveconfig.isinitialized = true;
}
var obj = document.getElementById (id);
obj.style.position = "Absolute";
var w = AMMOVECONFIG.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);
paso var = 1;
intervalo 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 = AMMOVECONFIG.MOVEHEIGHT - obj.Offsetheight;
x = x + paso * 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 + paso * 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 () {
retraso var = 10;
intervalo = setInterval (obj.custommethod, demora);
obj.onmouseover = function () {ClearInterval (intervalo); }
obj.onmouseOut = function () {interval = setInterval (obj.custommethod, demora); }
}
}
</script>
<!-漂浮开始->
<Div id = AD2 style = "Z-Index: 5; posición: relativo">
<a href = 'PoliceHtk.aspx' Target = '_ Blank'> <img src = "imágenes/fudong/fudong.jpg"> </a> <br> <a href = "#" onClick = "document.getElementById ('ad2'). style.display = 'Ninguno'"> <img bordes /> </a>
<!-漂浮结束->
</div>
<script type = "text/javaScript" lenguaje = "javaScript">
var ad2 = new AdMove ("AD2");
ad2.run ();
// 多组漂浮
</script>
<!-首页图片漂浮结束->