源:http://blog.csdn.net/szwangdf/article/details/4205553
评:
?[页面定位]锚的简单使用
?
1.使用window.location.hash定位到指定的锚
?
- <!DOCTYPE?HTML?PUBLIC?"-//W3C//DTD?HTML?4.0?Transitional//EN">??
- <HTML>??
- <HEAD>??
- <TITLE>?New?Document?</TITLE>??
- <META?NAME="Generator"?CONTENT="EditPlus">??
- <META?NAME="Author"?CONTENT="">??
- <META?NAME="Keywords"?CONTENT="">??
- <META?NAME="Description"?CONTENT="">??
- ??
- <mce:script?laguage="javascript"><!--??
- ????function?onTopClick()?{??
- ????????window.location.hash?=?"#top";???
- ????}??
- ????function?onBottomClick()?{??
- ????????window.location.hash?=?"#bottom";???
- ????}??
- //?--></mce:script>???
- </HEAD>??
- ??
- <BODY>??
- ????<a?name="top"></a>??
- ????<input?id="btnBottom"?type="button"?onclick="javascript:onBottomClick()"?value="跳转到底部"/><BR>??
- ????????1<BR>2<BR>3<BR>4<BR>5<BR>??
- ????????1<BR>2<BR>3<BR>4<BR>5<BR>??
- ????????1<BR>2<BR>3<BR>4<BR>5<BR>??
- ????????1<BR>2<BR>3<BR>4<BR>5<BR>??
- ????????1<BR>2<BR>3<BR>4<BR>5<BR>??
- ????????1<BR>2<BR>3<BR>4<BR>5<BR>??
- ????????1<BR>2<BR>3<BR>4<BR>5<BR>??
- ????????1<BR>2<BR>3<BR>4<BR>5<BR>??
- ????????1<BR>2<BR>3<BR>4<BR>5<BR>??
- ????????1<BR>2<BR>3<BR>4<BR>5<BR>??
- ????????1<BR>2<BR>3<BR>4<BR>5<BR>??
- ????????1<BR>2<BR>3<BR>4<BR>5<BR>??
- ????<input?id="btnBottom"?type="button"?onclick="javascript:onTopClick()"?value="跳转到顶部"/><BR>??
- ????<a?name="bottom"></a>??
- </BODY>??
- </HTML>?