0
Can I define something in HTML to set all of my hyperlink targets to "_blank"?
I'm in a Web Tech course and I have to use a bunch of hyperlinks, and it gets aggravating because sometimes I forget to add target="_blank" so it redirects me out of my assignment when I test. I'm using Adobe Dreamweaver as my editor, if that makes any difference
1 ответ
+ 4
No, but with JavaScript you can do this:
function setToBlank(){
     for (var i = 0; i < document.links.length; i++){
           document.links[i].setAttribute('target',  '_blank'); 
    }
}
This code sets the targets for each links to blank.



