js 问题集合

返回顶部插件(稍有问题):

 function goToTop() {            var w_to_right = 35;            var h_to_bottom = 40;            var str = "";            var obj = document.getElementById("divStayTopLeft");            if (obj) str = obj.innerHTML;            if (typeof document.compatMode != 'undefined' && document.compatMode != 'BackCompat') {                document.writeln('<div  style="z-index:9;right:0;bottom:0;height:' + h_to_bottom + 'px;width:' + w_to_right + 'px;overflow:hidden;POSITION:fixed;_position:absolute; _margin-top:expression(document.documentElement.clientHeight-this.style.pixelHeight+document.documentElement.scrollTop);">');            }            else {                document.writeln('<div  style="z-index:9;right:0;bottom:0;height:' + h_to_bottom + 'px;width:' + w_to_right + 'px;overflow:hidden;POSITION:fixed;*position:absolute; *top:expression(eval(document.body.scrollTop)+eval(document.body.clientHeight)-this.style.pixelHeight);">');            }            document.writeln('<div style="clear:both;margin:auto;height:30px;font-size:16px;overflow:hidden;font-weight:bold;text-align:left;"><a href="javascript:scroll(0,0)" hidefocus="true"><img src="Resources/Images/top.png" alt="回到顶部" style="border: 0px;" /></a></div> ');            document.write('<div style="clear:both;margin:auto;overflow:hidden;text-align:left;">' + str + '</div>');            document.writeln('</div>');        }        goToTop();

event.returnValue=false; firefox 不支持用下面的代替:

 function setReturnValueFalse() {
            if (document.all) {
                window.event.returnValue = false;
            }
            else {
                event.preventDefault();
            }
        };




你可能感兴趣的:(js 问题集合)