- 積分
- 114
- 威望
- 114
- 金錢
- 143
- 最後登錄
- 2012-9-8
|
代码可放在footer.htm的
</html>
上面- <script type="text/javascript">
- document.writeln("<div id=\"full\" style=\"width:20px; height:50px; position:fixed; left:50%; top:425px; margin-left:470px; z-index:100; text-align:center; cursor:pointer;\"><a><img src=\"http://www.discuz.net/static/image/common/scrolltop.png\" border=0 alt=\"返回顶部"></a></div>");
- var isie6 = window.XMLHttpRequest ? false: true;
- function newtoponload() {
- var c = document.getElementById("full");
- function b() {
- var a = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop;
- if (a > 0) {
- if (isie6) {
- c.style.display = "none";
- clearTimeout(window.show);
- window.show = setTimeout(function() {
- var d = document.documentElement.scrollTop || window.pageYOffset || document.body.scrollTop;
- if (d > 0) {
- c.style.display = "block";
- c.style.top = (400 + d) + "px"
- }
- },
- 300)
- } else {
- c.style.display = "block"
- }
- } else {
- c.style.display = "none"
- }
- }
- if (isie6) {
- c.style.position = "absolute"
- }
- window.onscroll = b;
- b()
- }
- if (window.attachEvent) {
- window.attachEvent("onload", newtoponload)
- } else {
- window.addEventListener("load", newtoponload, false)
- }
- document.getElementById("full").onclick = function() {
- window.scrollTo(0, 0)
- };
複製代碼 代码来自网络,不限于论坛,普通网站站也可放。 |
-
1
評分人數
-
|