复制代码代码如下:
<!-首页图片漂浮开始->
<script type = "text/javascript" idioma = "javascript">
função addEvent (obj, evttype, func, cap) {
CAP = CAP || falso;
if (obj.addeventListener) {
obj.addeventListener (evttype, func, cap);
retornar true;
} else if (obj.attachevent) {
if (cap) {
obj.setCapture ();
retornar true;
} outro {
retornar obj.attachevent ("on" + evttype, func);
}
} outro {
retornar falso;
}
}
function 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 = novo Array (XScroll, YScroll);
retornar ArrayPagesCroll;
}
function getPagesize () {
var xscroll, yscroll;
if (window.innerHeight && window.scrollmaxy) {
xscroll = document.body.scrollwidth;
yScroll = window.innerHeight + window.scrollmaxy;
} else if (document.body.scrolHeight> document.body.offsetheight) {
xscroll = document.body.scrollwidth;
yScroll = document.body.scrolHeight;
} outro {
xscroll = document.body.offsetWidth;
yScroll = document.body.offSethEight;
}
Var Windowwidth, WindowsHeight;
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;
} outro {
PageHeight = yScroll;
}
if (xScroll <WindowDth) {
PageWidth = Windowwidth;
} outro {
PageWidth = xScroll;
}
ArrayPagesize = new Array (PageWidth, PageHeight, WindowDth, WindowHeight)
return ArrayPagesize;
}
var admAveConfig = new Object ();
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 (janela, "redimensionar", AdMoveConfig.Resize);
addEvent (janela, "rolagem", AdMoveConfig.scroll);
função Admrove (id) {
if (! AdMoveConfig.isinitialized) {
AdmOveConfig.Resize ();
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 stage = 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 = AdMoveConfig.moveHeight - obj.offsetHeight;
x = x + etapa * 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 + etapa * 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 a atraso = 10;
interval = setInterval (obj.custommethod, atraso);
obj.onMouseOver = function () {clearInterval (intervalo); }
obj.onMouseOut = function () {interval = setInterval (obj.custommethod, atraso); }
}
}
</script>
<!-漂浮开始->
<Div id = ad2 style = "z-index: 5; posição: relativa">
<a href = 'policshtk.aspx' target = '_ Blank'> <img src = "imagens/fudong/fudong.jpg"> </a> <br> <a href = "#" onclick = "document.getElementById ('ad2'). /> </a>
<!-漂浮结束->
</div>
<script type = "text/javascript" idioma = "javascript">
var ad2 = new ADOMOVE ("AD2");
ad2.run ();
// 多组漂浮
</script>
<!-首页图片漂浮结束->