Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

window.open from a picture

Status
Not open for further replies.

LKB6

MIS
Mar 20, 2009
23
US

I have a code for window.open that looks like:

<a href="""" onclick=""window.open('POPWINDOW.asp?id=" & rsProduct("ProductID") & "', 'DDD', 'scrollbars,status,resizable,width=550,height=400,left=50,top=50'); return false"">Product Spec</a>

This works, but instead of clicking on the text'Product Spec' to open the window, I would like to click on a picture named 'PRD.jpg' for example and i cannot figure how to do this.

Any help would be appreciated.
Thanks in advance.
 
Just provide the same onclick event for the image in question. Something like this:

Code:
 <img src="PRD.jpg" onclick=""window.open('POPWINDOW.asp?id=" & rsProduct("ProductID") & "', 'DDD', 'scrollbars,status,resizable,width=550,height=400,left=50,top=50'); return false"" />
 
Exactly the same, except on an img element.
Code:
<img src="[red]PRD.jpg[/red]" onclick=""window.open('POPWINDOW.asp?id=" & rsProduct("ProductID") & "', 'DDD', 'scrollbars,status,resizable,width=550,height=400,left=50,top=50'); return false"">


Or stick the image in the link instead of the text.
Code:
<a href="""" onclick=""window.open('POPWINDOW.asp?id=" & rsProduct("ProductID") & "', 'DDD', 'scrollbars,status,resizable,width=550,height=400,left=50,top=50'); return false"">[red]<img src="PRD.jpg">[/red]</a>


----------------------------------
Phil AKA Vacunita
----------------------------------
Ignorance is not necessarily Bliss, case in point:
Unknown has caused an Unknown Error on Unknown and must be shutdown to prevent damage to Unknown.
 
Hi

Just a minor suggestion. If you choose to add [tt]onclick[/tt] to your [tt]img[/tt], set [tt]cursor: pointer[/tt] style to it, otherwise the visitors will not guess that the image is clickable.

By the way, clicking on an [tt]img[/tt] has no default action, so the [tt]return false[/tt] is useless there.


Feherke.
 
Thank you all for those explanations.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top