<script> <br>function $(id) <br>{ <br>return document.getElementById(id); <br>} <br>var LoginUI = !!window.LoginUI || {}; <br>LoginUI.getViewportWidth = function(){ <br>var width=0; <br>if(document.documentElement && document.documentElement.clientWidth){ <br>width=document.documentElement.clientWidth;} <br>else if(document.body && document.body.clientWidth){ <br>width= document.body.clientWidth;} <br>else if(window.innerWidth){ <br>width=window.innerWidth-18;} <br>return width; <br>} <br>LoginUI.getViewportHeight = function() { <br>var height=0; <br>if(window.innerHeight){ <br>height=window.innerHeight-18;} <br>else if(document.documentElement&&document.documentElement.clientHeight){ <br>height=document.documentElement.clientHeight;} <br>else if(document.body&&document.body.clientHeight){ <br>height=document.body.clientHeight;} <br>return height; <br>} <br>LoginUI.getViewportScrollX = function(){ <br>var scrollX=0; <br>if(document.documentElement&&document.documentElement.scrollLeft){ <br>scrollX=document.documentElement.scrollLeft;} <br>else if(document.body&&document.body.scrollLeft){ <br>scrollX=document.body. scrollLeft;} <br>else if(window.pageXOffset){ <br>scrollX=window.pageXOffset;} <br>else if(window.scrollX){ <br>scrollX=window.scrollX;} <br>scrollX 반환 ; <br>} <br>LoginUI.getViewportScrollY=function() { <br>var scrollY=0; <br>if(document.documentElement&&document.documentElement.scrollTop){ <br>scrollY=document.documentElement.scrollTop;} <br>else if(document.body&&document.body.scrollTop){ <br>scrollY=document.body. scrollTop;} <br>else if(window.pageYOffset){ <br>scrollY=window.pageYOffset;} <br>else if(window.scrollY){ <br>scrollY=window.scrollY;} <br>scrollY 반환 ; <br>} <br>function scrollMsgTip() <br>{ <br>var t = LoginUI.getViewportHeight() LoginUI.getViewportScrollY() - $("msgtip").offsetHeight; <br>$("msgtip").style.top = t "px"; <br>$("msgtip").style.left = LoginUI.getViewportWidth() LoginUI.getViewportScrollX() - $("msgtip").offsetWidth "px"; <br>} <br>function scrollTip() <br>{ <br>scrollMsgTip() <br>} <br>window.onload = window.onscroll = scrollTip; <br></script>
以上是js代码,下face是浮动的窗口
성명:본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.