The code is as follows:
<script><br>var x = 50, y = 60 //The initial position of the floating layer corresponds to the initial X coordinate and Y coordinate of the layer respectively <br>var xin = true, yin = true //Determine whether the X coordinate and Y coordinate of the layer are within the control range. If xin is true, the layer moves to the right, otherwise to the left; if yin is true, the layer moves downward, otherwise upward <br>var step = 1 //Layer The step length of movement. The larger the value, the faster the movement speed. <br>var delay = 10 //The time interval for layer movement, in milliseconds. The smaller the value, the faster the movement speed. <br>var obj=document.getElementByIdx_x("float ") //Capture the layer with id ad as a floating target<br>function floatAD() {<br>var L=T=0 //The left boundary (L) and upper boundary (T) coordinates of the layer movement range<br>var R= document.body.clientWidth-obj.offsetWidth //The right boundary of the layer movement<br>var B = document.body.clientHeight-obj.offsetHeight //The lower boundary of the layer movement<br>obj.style.left = x document.body.scrollLeft //Update the X coordinate of the layer to realize movement in the Within the visible range <br>obj.style.top = y document.body.scrollTop //Update the Y coordinate of the layer to achieve movement in the Y-axis direction; document.body.scrollTop is the downward distance of the scroll bar in the document area , to ensure that the layer is still within the visible range when the scroll bar is pulled down<br>x = x step*(xin?1:-1) //Determine the movement direction of the layer on the X axis by judging the range of the layer<br>if (x < L) { xin = true; x = L} //Handling when the layer exceeds the left boundary<BR>if (x > R){ xin = false; x = R} //When the layer exceeds the right boundary Processing<br>y = y step*(yin?1:-1) //Determine the movement direction of the layer on the Y axis by judging the range of the layer<br>if (y < T) { yin = true; y = T } //Handling when the layer exceeds the upper boundary<BR>if (y > B) { yin = false; y = B } //Handling when the layer exceeds the lower boundary<br>}<br>var itl= setInterval("floatAD()", delay) //Execute the floatAD function every delay seconds<br>obj.onmouseover=function(){clearInterval(itl)} //The layer clears the above interval event when the mouse moves up, to achieve The effect of stopping the movement of the layer when the mouse moves up<br>obj.onmouseout=function(){itl=setInterval("floatAD()", delay)} //The layer starts interval events when the mouse moves away to realize the layer's movement when the mouse moves up The effect of continuing to move when the mouse is removed <br></script>
Note:
Insert Flash and floating ads into the web page, you will find that the floating ads float to the Flash The time will be below,
How do we solve this problem?
The rest is very simple
Just add the following statement to the flash code position
Example:
If the following is the code where the flash is located: