<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="jq.js"></script>
<script type="text/javascript">
function goTotop(obj){
var _targetTop = $('#'+obj).offset().top;//獲取位置
jQuery("html,body").animate({scrollTop:_targetTop},300);//跳轉(zhuǎn)
}
</script>
<title>實(shí)現(xiàn)頁內(nèi)跳轉(zhuǎn)定位到某個(gè)ID</title>
<style type="text/css">
#content {margin:0 auto;width:1000px;}
#content .box01_con {height:38px;margin:15px 0;}
#content .box01_con .menu {float:left;margin-top:8px;overflow:hidden;}
#content .box01_con .menu li {float:left;margin-right:28px;list-style-type:none;}
#content .box01_con .menu li a {color:#282828;display:block;font-size:14px;height:16px;line-height:16px;padding-left:26px;}
.box04_con {margin-top:0px;height:300px;border-top:5px solid #ccc;font-weight:bold;}
</style>
</head>
<body>
<div id="content">
<div class="box01_con">
<ul class="menu">
<li><a href="javascript:void(0)" onclick="goTotop('xwbg')">跳轉(zhuǎn)測(cè)試一</a></li>
<li><a href="javascript:void(0)" onclick="goTotop('xcshow')"><b>測(cè)試二</a></li>
<li><a href="javascript:void(0)" onclick="goTotop('wdy')">跳轉(zhuǎn)測(cè)試三</a></li>
<li><a href="javascript:void(0)" onclick="goTotop('mv')"><跳轉(zhuǎn)測(cè)試四</a></li>
<li><a href="javascript:void(0)" onclick="goTotop('dsy')">跳轉(zhuǎn)測(cè)試五</a></li>
</ul>
</div>
<div class="box04_con" id="xwbg"><h4>跳轉(zhuǎn)測(cè)試一</h4></div>
<div class="box04_con" id="xcshow" ><h4>跳轉(zhuǎn)測(cè)試二</h4></div>
<div class="box04_con" id="wdy"><h4>跳轉(zhuǎn)測(cè)試三</h4></div>
<div class="box04_con" id="mv"><h4>跳轉(zhuǎn)測(cè)試四</h4></div>
<div class="box04_con" id="dsy"><h4>跳轉(zhuǎn)測(cè)試五</h4></div>
</div>
<div >ddd</div>
<a href="javascript:void(0)" onclick="goTotop('xcshow')">跳轉(zhuǎn)測(cè)試一</a>
<!--
相關(guān)資料
http://www.dbpoo.com/js-anchor-name-id/
http://blog.csdn.net/huaishuming/article/details/8951504
-->
</body>
</html>
另外有需要云服務(wù)器可以了解下創(chuàng)新互聯(lián)scvps.cn,海內(nèi)外云服務(wù)器15元起步,三天無理由+7*72小時(shí)售后在線,公司持有idc許可證,提供“云服務(wù)器、裸金屬服務(wù)器、高防服務(wù)器、香港服務(wù)器、美國(guó)服務(wù)器、虛擬主機(jī)、免備案服務(wù)器”等云主機(jī)租用服務(wù)以及企業(yè)上云的綜合解決方案,具有“安全穩(wěn)定、簡(jiǎn)單易用、服務(wù)可用性高、性價(jià)比高”等特點(diǎn)與優(yōu)勢(shì),專為企業(yè)上云打造定制,能夠滿足用戶豐富、多元化的應(yīng)用場(chǎng)景需求。
網(wǎng)站欄目:實(shí)現(xiàn)頁內(nèi)跳轉(zhuǎn)定位到某個(gè)ID-創(chuàng)新互聯(lián)
URL網(wǎng)址:http://chinadenli.net/article30/dgjiso.html
成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供響應(yīng)式網(wǎng)站、網(wǎng)站排名、品牌網(wǎng)站制作、搜索引擎優(yōu)化、全網(wǎng)營(yíng)銷推廣、網(wǎng)站設(shè)計(jì)公司
聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來源: 創(chuàng)新互聯(lián)
猜你還喜歡下面的內(nèi)容