HTML下載屬性
<area> 元素的下載屬性用於設定待下載的檔名稱,當用戶點選超連結時將會下載此檔案。
以下是語法 −
<area download="file">
檔案為設定下載的檔名稱。
現在我們來看一個示例,演示 <area> 元素的下載屬性的實現 −
示例
<!DOCTYPE html> <html> <body> <h2>Learning</h2> <p>Learn these technologies with ease....</p> <img src = /images/usemap.gif alt = "usemap" border = "0" usemap = "#tutorials"/> <map name = "tutorials"> <area shape = "poly" coords = "74,0,113,29,98,72,52,72,38,27" href = "/perl/index.htm" alt = "Perl Tutorial" download="perl" /> <area shape = "rect" coords = "22,83,126,125" alt = "HTML Tutorial" href = "/html/index.htm" target = "_blank" download="html" /> <area shape = "circle" coords = "73,168,32" alt = "PHP Tutorial" href = "/php/index.htm" target = "_blank" download="php" /> </map> </body> </html>
輸出
現在,當您點選“PERL”時,檔案將如下所示下載 −
上面,我們已經使用 <area> 的下載屬性啟用了下載選項 −
<area shape = "poly" coords = "74,0,113,29,98,72,52,72,38,27" href = "/perl/index.htm" alt = "Perl Tutorial" download="perl" />
下載屬性設定的名稱為“perl”。這也是檔案的名稱 −
download="perl"
廣告