Mega Code Archive

 
Categories / JavaScript DHTML / HTML
 

Change the target attribute of a link

<html> <head> <script type="text/javascript"> function myTarget(){     document.getElementById('myAnchor').target="_blank" } </script> </head> <body>     <a id="myAnchor" href="http://www.rntsoft.com">Visit rntsoft</a>     <form>         <input type="button" onclick="myTarget()" value="Make the link open in a new window!">     </form>     <p>Try the link before and after you have pressed the button!</p> </body> </html>