1

I have added following code in wordpress to hide status bar. It works but I want to open link in new window. How can I do that?

<img style='cursor:pointer;' src='http://www.killerpreseller.com/images2/buynow.gif' onclick="window.location='http://www.yahoo.com'"/>
Bernhard Barker
  • 54,589
  • 14
  • 104
  • 138

2 Answers2

1

Use an anchor with target '_blank' wrapping your image

<a href='http://www.killerpreseller.com/images2/buynow.gif' target='_blank'>
   <img style='cursor:pointer;' src='http://www.killerpreseller.com/images2/buynow.gif' />
</a>

http://jsfiddle.net/Ree5t/

megawac
  • 10,953
  • 5
  • 40
  • 61
0

You can use:

window.open('http://www.killerpreseller.com/images2/buynow.gif', '_blank');

As per How to simulate target="_blank" in JavaScript

This is the equivalent of an anchor tag with target='blank' set.

Community
  • 1
  • 1
onepointsixtwo
  • 108
  • 1
  • 8