I'm trying to get url from some links. If I click on the google link, output should be google.com and for other links should be the same. But I don't know how to do that. Sorry I'm too new to programming. Help me out please.Thank you My code is here, please guide me well for this task. Thanks again...`
<script>
function get_url() {
document.getElementById("field1").value = document.getElementById("url").value;
}
</script>
<a onclick="get_url()" target = "_blank" id = "url" href="http://www.google.com/">Google </a> <br/>
<a onclick="get_url()" target = "_blank" id = "url" href="http://www.facebook.com/">Facebook </a><br/>
<a onclick="get_url()" target = "_blank" id = "url" href="http://www.twitter.com/">Twitter </a><br/>
<a onclick="get_url()" target = "_blank" id = "url" href="http://www.youtube.com/">Youtube </a><br/><br/>
URL : <input type="text" id="field1"><br><br>
<p>Click on the link above to get the URL of the linked document.</p>