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"
广告