<!DOCTYPE html>
<html>
<body>
<a id="myAnchor" href="http://www.w3schools.com/images/myw3schoolsimage.jpg" download="w3logo">
<img border="0" src="http://www.w3schools.com/images/myw3schoolsimage.jpg" alt="W3Schools" width="104" height="142"></a>
<p>Click the "Try it" button to change the value of the download attribute of the image link above.</p>
<p><b>Tip:</b> Click on the image before and after you have clicked on the "Try it" button.</p>
<button onclick="myFunction()">Try it</button>
<p id="demo"></p>
<script>
function myFunction() {
document.getElementById("myAnchor").download = "newValue";
document.getElementById("demo").innerHTML = "The value of the download attribute was changed from 'w3logo' to 'newValue'.";
}
</script>
</body>
</html>