如何在使用者點選 HTML 中的超連結時指定下載目標?


使用 download 屬性可在單擊超連結時設定要下載的檔案。將此屬性的值設定為下載檔案的檔名,例如影像。

示例

<!DOCTYPE html>
<html>
   <body>
      <h3>if statement in Java</h3>
      <p>The following is an image explaining the concept if <b>if-statmement in Java</b> (Click to download):<p>
     
      <a href = "https://tutorialspoint.tw/java/images/if_statement.jpg" download>
         <img border = "0" src = "https://tutorialspoint.tw/java/images/if_statement.jpg" alt="Java" width="400" height="450">
      </a>
   </body>
</html>

更新於: 2020-03-03

121 次瀏覽

開啟你的職業生涯

透過完成課程獲得認證

開始學習
廣告
© . All rights reserved.