iframe
a
4個target
<a href="qq.com" target="_blank"></a>
<a href="qq.com" target="_self"></a>
<a href="qq.com" target="_parent"></a>
<a href="qq.com" target="_top"></a>
複製程式碼
依次為新頁面開啟,當前頁面覆蓋開啟,在父頁面開啟,在頂部頁面開啟
當a標籤的網頁A被當做iframe放在網頁B再當做iframe放在網頁C時,以上意思分別為:
- 新開網頁D
- 在網頁A開啟
- 在網頁B開啟
- 在網頁C(D,E)開啟
download屬性
<a href="https://qq.com" download></a>
複製程式碼
點選可以下載整個網頁
href可以寫什麼
<a href="qq.com">qq</a>
複製程式碼
此時qq.com相當於絕對路徑,未加http
<a href="//qq.com">qq</a>
複製程式碼
此時使用//qq.com,含義為使用當前使用的協議,即file協議

- 瀏覽器加錨點
<a href="#12">qq</a>
(不發起請求,因為錨點的作用是頁面內的跳轉) - 瀏覽器加路徑
<a href="?name=soldiermakk">qq</a>
(自動發起get請求) - 開啟當前目錄下的網頁
<a href="./index2.html">qq</a>
- 偽協議(點選之後什麼也不做)
<a href"javascript:;">qq<a>
iframe與a同時使用
name的用法


同時,iframe也支援寫相對路徑
<iframe name=xxx src="./index2.html" frameborder="0"></iframe>
複製程式碼