运行 ❯
获取您
自己的
网站
×
更改方向
保存代码
更改主题,深色/浅色
前往 Spaces
<!DOCTYPE html> <html> <body> <h1>The Anchor Object</h1> <h2>The download Attribute</h2> <a id="myAnchor" href="w3schools.jpg" download="w3logo"> <img src="w3schools.jpg" alt="W3Schools" width="104" height="142"></a> <p>The value of the download attribute is:</p> <p id="demo"></p> <script> document.getElementById("myAnchor").download = "newValue"; document.getElementById("demo").innerHTML = document.getElementById("myAnchor").download; </script> </body> </html>