Hi
I am trying to do a javascript program. My a trying a program such that, when i call the chg() method it applies only second element that is link2. Actually I want is, when I click the link, the name of the link should be displayed in the text field. Any one knows how to do this. Please help. I am posting my code please have a look on it.
Any advice or suggestion on this.Code:<form> <a id="static" href="scadmin.ioml">link1</a></br> <a id="static" href="scadmin.ioml">link2</a></br> <input type="text" id="spec" name="content"/> </form> <script> var a = document.getElementsByTagName("a"); for(var i=0;i<a.length;i++){ a[i].href="#"; var ale = a[i].innerHTML; a[i].onclick =chg(ale); } function chg(object){ var inputobj = document.getElementById("spec"); inputobj.value = object; } </script>
Bookmarks