复制代码代码如下:
<! - 首页图片漂浮开始 ->
<script type = "text / javascript" linguistique = "javascript">
fonction addevevent (obj, evttype, func, cap) {
cap = cap || FAUX;
if (obj.addeventListener) {
obj.addeventListener (evttype, func, cap);
Retour Vrai;
} else if (obj.attachevent) {
if (cap) {
obj.setCapture ();
Retour Vrai;
} autre {
return obj.attachevent ("on" + evttype, func);
}
} autre {
retourne false;
}
}
fonction 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 = nouveau tableau (xscroll, yscroll);
return ArrayPagesCroll;
}
fonction 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;
} autre {
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;
} autre {
PageHeight = yscroll;
}
if (xscroll <windowwidth) {
PageWidth = WindowWidth;
} autre {
PageWidth = xscroll;
}
ArrayPageSize = nouveau tableau (pagewidth, pageHeight, fenêtre, fenêtre)
return arrayPageSize;
}
var adrovoConfig = new object ();
AdMoveConfig.Isinitialized = false;
AdMoveConfig.Scrollx = 0;
AdMovoConfig.Scrolly = 0;
AdMoveConfig.MoveWidth = 0;
AdMoveConfig.MoveHeight = 0;
AdmivoConfig.resize = function () {
var winsize = getPageSize ();
AdMoveConfig.MoveWidth = WinSize [2];
AdMovoConfig.MoveHeight = WinSize [3];
AdMovoConfig.Scroll ();
}
AdmivoConfig.scroll = function () {
var winscroll = getPagescroll ();
AdMoveConfig.Scrollx = Winscroll [0];
AdMovoConfig.Scrolly = Winscroll [1];
}
addEvent (fenêtre, "redimensit", adovoConfig.resize);
addEvent (fenêtre, "Scroll", AdmoveConfig.Scroll);
Fonction Admive (id) {
if (! admiveconfig.isinitialized) {
AdMovoConfig.Resize ();
AdMoveConfig.Isinitialized = true;
}
var obj = document.getElementById (id);
obj.style.position = "Absolute";
var w = admiveconfig.movewidth - obj.offsetwidth;
var h = admiveconfig.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 étape = 1;
intervalle var;
this.setLocation = function (vx, vy) {x = vx; y = vy; }
this.setDirection = fonction (vx, vy) {dirx = vx; diry = vy; }
obj.customethod = function () {
obj.style.left = (x + adrovoconfig.scrollx) + "px";
obj.style.top = (y + adrovoconfig.scrolly) + "px";
rad = (math.random () + 1) * math.pi / 6;
W = admivoConfig.movewidth - obj.offsetwidth;
H = admivoconfig.moveheight - obj.offsetheight;
x = x + étape * 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 + étape * 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.custométhod, retard);
obj.onmouseOver = function () {ClearInterval (interval); }
obj.onmouseout = function () {interval = setInterval (obj.custométhod, retard); }
}
}
</cript>
<! - 漂浮开始 ->
<Div id = ad2 style = "z-index: 5; position: relative">
<a href = 'polithtk.aspx' cible = '_ blanc'> <img src = "images / fudong / fudong.jpg"> </a> <br> <a href = "#" onclick = "document.getElementbyid ('ad2'). style.display = 'nul'"> <img border = 0 src = images / fudong / close1.gif /> </a>
<! - 漂浮结束 ->
</div>
<script type = "text / javascript" linguistique = "javascript">
var ad2 = new Admive ("ad2");
ad2.run ();
// 多组漂浮
</cript>
<! - 首页图片漂浮结束 ->