2012-07-18 89 views
1

我正在做一個門戶網站,但我有點困惑與鏈接的使用。問題是。鏈接在html困惑

我的應用程序是在http://localhost/applicacion/default.aspx(應用程序是應用程序目錄)

如果我把一個鏈接<a href="../Admin/defaultadmin.aspx">Link</a>它帶我到

http://localhost/Admin/defaultadmin.aspx instead of take me to ---> http://localhost/applicacion/Admin/defaultadmin.aspx 

然後我嘗試用鏈接需要我來

http://localhost/applicacion/Admin/defaultadmin.aspx but if i am in another part of the site like http://localhost/applicacion/sales/defaultsales.aspx it takes me to 
http://localhost/applicacion/sales/Admin/defaultadmin.aspx witchs is wrong !! 

什麼是嚴謹的組合,所以鏈接總是讓我一直到同一點,考慮到應用程序目錄可以改變t他的安裝使部分必須是動態的,我的意思是我不能在鏈接<a href="Application/Admin/defaultadmin.aspx">Link</a>,因爲用戶可能會安裝在另一個網站。

謝謝!

+1

請張貼一些代碼。 – j08691 2012-07-18 15:52:13

回答

2

你被../指出,以轉到父目錄:

<a href="../Admin/defaultadmin.aspx">Link</a> 

如果你想去一個子目錄則省略../,只是使用子目錄,後跟所需的名稱頁碼:

<a href="Admin/defaultadmin.aspx">Link</a>