2017-02-15 90 views
0

我有一個頁面index.html。假設我有其他頁面index2.html。 通過點擊index.html中的某個鏈接,我想移動到index2.html中的某個div id。是否可以使用css或js?導航不同的頁面

index.html的有以下鏈接:

<a href="index2.html #div2"> <!--code i am looking for--> 

index2.html有以下內容

<div id="div1" style="height:1000px;width:100%"></div> 
<div id="div2" style="height:400px;width:100%"></div> 

回答

1

是。這個有可能。事實上,你已經做得對了。改變從

<a href="index2.html #div2"> 

<a href="index2.html#div2"> 

手段應該有index2.html和#DIV2之間沒有空格。

我希望這會有所幫助。

0

是刪除你的頁面之間放

<a href="index2.html#div2"> <!--code you need--> 

希望的空間和div id

<a href="index2.html #div2"> <!--code i am looking for--> 

更改爲

你這是如何工作