JSFiddle - React, Tailwind, and code Playground

by downedcrane

HTML

<!-- Easy JavaScript # 17 - onclick event handler -->
<p>
Let's download a book!
</p>
<input type=text id="link" value="link to jpg">
<br>
<button id="city">Get link</button>


<p>
Your link is <a id="outputName" href="" target="_blank">link</a>.
</p>

<script>
document.getElementById("city").onclick = function(){
	var name = document.getElementById("link").value;
  var pos1 = name.replace("C21COM=7", "C21COM=2")
  var pos2 = pos1.replace("FILE_PAGE=1", "FILE_DOWNLOAD=1")
  document.getElementById("outputName").href = pos2;
}
</script>