[页面定位]锚的简单使用
1.使用window.location.hash定位到指定的锚
1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
2. <HTML>
3. <HEAD>
4. <TITLE> New Document </TITLE>
5. <META NAME="Generator" CONTENT="EditPlus">
6. <META NAME="Author" CONTENT="">
7. <META NAME="Keywords" CONTENT="">
8. <META NAME="Description" CONTENT="">
9.
10. <mce:script laguage="javascript"><!--
11. function onTopClick() {
12. window.location.hash = "#top";
13. }
14. function onBottomClick() {
15. window.location.hash = "#bottom";
16. }
17. // --></mce:script>
18. </HEAD>
19.
20. <BODY>
21. <a name="top"></a>
22. <input id="btnBottom" type="button" onclick="javascript:onBottomClick()" value="跳转到底部"/><BR>
23. <BR>2<BR>3<BR>4<BR>5<BR>
24. <BR>2<BR>3<BR>4<BR>5<BR>
25. <BR>2<BR>3<BR>4<BR>5<BR>
26. <BR>2<BR>3<BR>4<BR>5<BR>
27. <BR>2<BR>3<BR>4<BR>5<BR>
28. <BR>2<BR>3<BR>4<BR>5<BR>
29. <BR>2<BR>3<BR>4<BR>5<BR>
30. <BR>2<BR>3<BR>4<BR>5<BR>
31. <BR>2<BR>3<BR>4<BR>5<BR>
32. <BR>2<BR>3<BR>4<BR>5<BR>
33. <BR>2<BR>3<BR>4<BR>5<BR>
34. <BR>2<BR>3<BR>4<BR>5<BR>
35. <input id="btnBottom" type="button" onclick="javascript:onTopClick()" value="跳转到顶部"/><BR>
36. <a name="bottom"></a>
37. </BODY>
38. </HTML>
标签:2345,定位,JavaScript,使用,New,页面
From: https://blog.51cto.com/u_16080829/6209375