html 錨點(超連結跳轉和js中跳轉)

來源:互聯網
上載者:User

標籤:style   color   io   java   ar   strong   div   sp   問題   

超連結跳轉
同頁面:
<a href="#q1">問題一?</a><a href="#q1">問題二?</a><a href="#q1">問題二?</a><a name="q1">問題一的解答</a>不同頁面:a.html的內容<a href="b.html#q1">問題一?</a>b.html的內容<a name="q1">問題一的解答</a>
註:1.確定在同一個頁面開啟如果<a href="#q1">問題一?</a><a href="#q2">問題二?</a>這樣寫不是在同一個頁面開啟的話,要加 target="_self"如:  <a href="#q1" target="_self">問題一?</a><a href="#q2" target="_self">問題二?</a>添加錨點就是為了在同一個頁面方便快捷地找到相應位置,所以要確定在同一個頁面開啟才好,呵呵2.只要是跳到同一個地方,錨點名稱必須是一樣的。3.添加錨點,起始位置和結束位置必須都是用<a></a>標記來寫的,前面是用href="#錨點名",後面是name="錨點名";

js跳轉
<script language="javascript">            
location.hash="#id1";  // id
location.hash="name1" //name
</script>
<div id="id1"></div>
<div name="name1"></div>


html 錨點(超連結跳轉和js中跳轉)

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.