PDA

View Full Version : image --> onclick --> href to target



Francisco Dias
12-04-2007, 05:35 PM
I think title says it all.
I need help, I am trying to use an onclick function (on an image), to open an html file in a certain target...

How can I archive this??

jscheuer1
12-04-2007, 05:48 PM
You don't even need javascript for that, although it can be used. Without javascript:


<a href="whatever.htm" target="whatever"><img border="0" src="some.jpg" alt=""></a>

With javascript, there are many, many possibilities. The most basic is:


<a onclick="window.open(this.href,this.target);return false;" href="whatever.htm" target="whatever"><img border="0" src="some.jpg" alt=""></a>