Change hyperlink innerHTML
|
|
<html> <head> <script language="JavaScript" type = "text/javascript"> <!-- function ChangeLink() { var newlink = document.getElementById("urltext"); var curlink = document.getElementById("oldurl"); curlink.href = ("http://" + newlink.value); curlink.innerHTML = newlink.value; }
function NewWindow(prefval) { var curlink = document.getElementById("oldurl"); if (prefval == 1) { curlink.setAttribute("target", "_blank"); } else if (prefval == 2) { curlink.removeAttribute("target"); } } //--> </script> </head> <body> <form> <a id="oldurl" href="http://www.navioo.com">www.navioo.com</a> <P><input type="radio" value="V1" name="R1" onClick="NewWindow(1)">Open in New Window</p> <P><input type="radio" name="R1" checked value="V2" onClick="NewWindow(2)">Open in Same Window</p> <input type="text" id="urltext" size="20"> <input type="button" value="Change Link" name="B3" onClick="ChangeLink()"></p> </form> </body> </html>
|
|
|
HTML code for linking to this page:
Related in same category :
-
-
-
|