How Do I Pass The Value Of A Variable To An Specific Page Element With Solely JavaScript?
Let's say I have: var url='http://www.google.html'; how do I put the URL variable value as the href value of a specific anchor tag in the page? I know about str.link() but how can
Solution 1:
For anchor elements:
<a id="myAnchor">link me!</a>
...
<script type="text/javascript">
var url = "http://www.google.html"; // .html is the new .com
var myAnchor = document.getElementById('myAnchor');
myAnchor.href = url;
</script>
Post a Comment for "How Do I Pass The Value Of A Variable To An Specific Page Element With Solely JavaScript?"