问题
I have a page with a JavaScript code:
http://pastehtml.com/view/1d997i8.html
please view source code
When you open the page a random banner will be displayed. When I click on the banner, i want to open the link on the banner in a new window.
Right now it opens on the same window.
Any help is appreciated. Thank you
回答1:
< a href="somehwere" target="_blank">yay a new window< /a >
You need to set the "target" attribute in the link
回答2:
You could use jQuery and include the following in the script:
$('a').attr('target','_blank');
来源:https://stackoverflow.com/questions/5013225/javascript-banner-link-open-in-new-window