HTML area download 屬性
實例
一個帶有可點擊下載區域的圖片:
<img src="planets.gif" width="145" height="126" alt="Planets" usemap="#planetmap">
<map name="planetmap">
<area shape="rect" coords="0,0,82,126" alt="Sun" href="information_about_the_sun.htm" download="sun">
<area shape="circle" coords="90,58,3" alt="Mercury" href="merglobe.gif" download="mercury">
<area shape="circle" coords="124,58,8" alt="Venus" href="information_about_the_planet_venus.txt" download="venus">
</map>
<map name="planetmap">
<area shape="rect" coords="0,0,82,126" alt="Sun" href="information_about_the_sun.htm" download="sun">
<area shape="circle" coords="90,58,3" alt="Mercury" href="merglobe.gif" download="mercury">
<area shape="circle" coords="124,58,8" alt="Venus" href="information_about_the_planet_venus.txt" download="venus">
</map>
嘗試一下»
瀏覽器支持
目前只有Firefox 和Chrome支持download 屬性。
定義和用法
download 屬性指定了下載鏈接地址。
只有在使用了href屬性才需要指定download屬性。
該屬性屬性同樣可以指定下載文件的名稱。 文件名稱沒有限定值,瀏覽器會自動在文件名稱末尾添加該下載文件的後綴(.img, .pdf, .txt, .html, 等)。
HTML 4.01 與HTML5之間的差異
The download attribute is new for the <area> tag in HTML5.
語法
<area
download="filename">
屬性值
值 | 描述 |
---|---|
filename | 指定文件名称。 |