<div class="codetitle"> <span><a style="CURSOR: pointer" data="41935" class="copybut" id="copybut41935" onclick="doCopy('code41935')"><u>コードをコピー</u></a></span> コードは次のとおりです:</div> <div class="codebody" id="code41935"> <br><!--首页图片浮开開始--> <br><script type="text/javascript" language="javascript"> <br>function addEvent(obj, evtType, func, cap) { <br>cap = cap ||間違い; <br>if (obj.addEventListener) { <br>obj.addEventListener(evtType, func, cap); <br>true を返します。 <br>} else if (obj.attachEvent) { <br>if (cap) { <br>obj.setCapture(); <br>true を返します。 <br>} else { <br>return obj.attachEvent("on" evtType, func); <br>} <br>} else { <br>return false; <br>} <br>} <br>関数 getPageScroll() { <br>var xScroll, yScroll; <br>if (self.pageXOffset) { <br>xScroll = self.pageXOffset; <br>} else if (document.documentElement && document.documentElement.scrollLeft) { <br>xScroll = document.documentElement.scrollLeft; <br>} else if (document.body) { <br>xScroll = document.body.scrollLeft; <br>} <br>if (self.pageYOffset) { <br>yScroll = self.pageYOffset; <br>} else if (document.documentElement && document.documentElement.scrollTop) { <br>yScroll = document.documentElement.scrollTop; <br>} else if (document.body) { <br>yScroll = document.body.scrollTop; <br>} <br>arrayPageScroll = new Array(xScroll, yScroll); <br>戻り arrayPageScroll; <br>} <br>function GetPageSize() { <br>var xScroll, yScroll; <br>if (window.innerHeight && window.scrollMaxY) { <br>xScroll = document.body.scrollWidth; <br>yScroll = window.innerHeight window.scrollMaxY; <br>} else if (document.body.scrollHeight > document.body.offsetHeight) { <br>xScroll = document.body.scrollWidth; <br>yScroll = document.body.scrollHeight; <br>} else { <br>xScroll = document.body.offsetWidth; <br>yScroll = document.body.offsetHeight; <br>} <br>var windowWidth, windowHeight; <br>if (self.innerHeight) { <br>windowWidth = self.innerWidth; <br>windowHeight = self.innerHeight; <br>} else if (document.documentElement && document.documentElement.clientHeight) { <br>windowWidth = document.documentElement.clientWidth; <br>windowHeight = document.documentElement.clientHeight; <br>} else if (document.body) { <br>windowWidth = document.body.clientWidth; <br>windowHeight = document.body.clientHeight; <br>} <br>if (yScroll < windowHeight) { <BR>pageHeight = windowHeight; <BR>} else { <BR>pageHeight = yScroll; <BR>} <BR>if (xScroll < windowWidth) { <BR>pageWidth = windowWidth; <BR>} else { <BR>pageWidth = xScroll; <BR>} <BR>arrayPageSize = new Array(pageWidth, pageHeight, windowWidth, windowHeight) <BR>return arrayPageSize; <BR>} <br><br>var AdMoveConfig = new Object(); <BR>AdMoveConfig.IsInitialized = false; <BR>AdMoveConfig.ScrollX = 0; <BR>AdMoveConfig.ScrollY = 0; <BR>AdMoveConfig.MoveWidth = 0; <BR>AdMoveConfig.MoveHeight = 0; <BR>AdMoveConfig.Resize = function () { <BR>var winsize = GetPageSize(); <BR>AdMoveConfig.MoveWidth = winsize[2]; <BR>AdMoveConfig.MoveHeight = winsize[3]; <BR>AdMoveConfig.Scroll(); <BR>} <BR>AdMoveConfig.Scroll = function () { <BR>var winscroll = getPageScroll(); <BR>AdMoveConfig.ScrollX = winscroll[0]; <BR>AdMoveConfig.ScrollY = winscroll[1]; <BR>} <BR>addEvent(window, "resize", AdMoveConfig.Resize); <BR>addEvent(window, "scroll", AdMoveConfig.Scroll); <BR>function AdMove(id) { <BR>if (!AdMoveConfig.IsInitialized) { <BR>AdMoveConfig.Resize(); <BR>AdMoveConfig.IsInitialized = true; <BR>} <BR>var obj = document.getElementById(id); <BR>obj.style.position = "絶対"; <BR>var W = AdMoveConfig.MoveWidth - obj.offsetWidth; <BR>var H = AdMoveConfig.MoveHeight - obj.offsetHeight; <BR>var x = W * Math.random(), y = H * Math.random(); <BR>var rad = (Math.random() 1) * Math.PI / 6; <BR>var kx = Math.sin(rad)、ky = Math.cos(rad); <BR>var dirx = (Math.random() < 0.5 ? 1 : -1), diry = (Math.random() < 0.5 ? 1 : -1); <BR>変数ステップ = 1; <BR>var 間隔; <BR>this.SetLocation = function (vx, vy) { x = vx; y = vy; <BR>this.SetDirection = function (vx, vy) { dirx = vx;ディリー = ヴィ; } <BR>obj.CustomMethod = function () { <BR>obj.style.left = (x AdMoveConfig.ScrollX) "px"; <BR>obj.style.top = (y AdMoveConfig.ScrollY) "px"; <BR>rad = (Math.random() 1) * Math.PI / 6; <BR>W = AdMoveConfig.MoveWidth - obj.offsetWidth; <BR>H = AdMoveConfig.MoveHeight - obj.offsetHeight; <BR>x = x ステップ * kx * dirx; <BR>if (x < 0) { dirx = 1; x = 0; kx = Math.sin(rad); ky = Math.cos(rad); } <BR>if (x > W) { dirx = -1; x = W; kx = Math.sin(rad); ky = Math.cos(rad); } <BR>y = y ステップ * ky * diry; <BR>if (y < 0) { diry = 1; y = 0; kx = Math.sin(rad); ky = Math.cos(rad); } <BR>if (y > H) { diry = -1; y = H; kx = Math.sin(rad); ky = Math.cos(rad); } <BR>} <BR>this.Run = function () { <BR>var late = 10; <BR>間隔 = setInterval(obj.CustomMethod, 遅延); <BR>obj.onmouseover = function () {clearInterval(間隔); <BR>obj.onmouseout = function () { 間隔 = setInterval(obj.CustomMethod, 遅延); } <BR>} <BR>}<BR></script> <br><!--フローティング開始--> <br><DIV id=ad2 style="Z-INDEX: 5;position:relative"> 🎜><a href='PoliceHTk.aspx' target='_blank'><IMG src="images/fudong/fudong.jpg" width="230" height="150" border="0" > </a><br> <a href="#" onclick="document.getElementById('ad2').style.display='none'"> /close 1.gif />gt; ; <br><!--フローティングの終了--> <br></DIV> <br><br> var ad2 = new AdMove("ad2"); <br>ad2.Run()<br>//フロートの複数のグループ<br><br></script>端が浮いている画像--><br><br> </div>