Solved

Javascript new window using an image as hyperlink

Posted on 2006-07-10
6
264 Views
Last Modified: 2008-01-09
I need to have an image act as a hyperlink and when the user clicks on it, I need a new window to open that I can specify the size and location of the window.  I've tried this but it doesn't work:

<span class="popup" onClick=javascript:window.open("player.aspx?id=49",blank","toolbar=no,width=320,height=290,top=0,left=0")><img src="images/KPC/kidsfest_04.jpg"></span>

Please help!
Bobby
0
Comment
Question by:azyet24
  • 3
  • 2
6 Comments
 
LVL 17

Accepted Solution

by:
BogoJoker earned 250 total points
ID: 17076076
Try this, using double quotes around the onClick="...":

<span class="popup" onClick="javascript:window.open('player.aspx?id=49','blank','toolbar=no,width=320,height=290,top=0,left=0');"><img src="images/KPC/kidsfest_04.jpg"></span>

Joe P
0
 
LVL 10

Expert Comment

by:0h4crying0utloud
ID: 17076077

try this:

      <span class="popup" onClick=javascript:window.open("player.aspx?id=49","","toolbar=no,width=320,height=290,top=0,left=0")><img src="images/KPC/kidsfest_04.jpg"></span>
0
 

Author Comment

by:azyet24
ID: 17076123
Ok, I can see that this will be confusing.  How can I make this look and act like a hyperlink (hand appears on rollover)?
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 17

Expert Comment

by:BogoJoker
ID: 17076132
<img style="cursor: pointer;" src="...">

Joe P
0
 
LVL 17

Expert Comment

by:BogoJoker
ID: 17076145
That same style code can be put in the <span> if you don't want it in the <img>
<span class="popup" onClick="..." style="cursor: pointer;"><img src="..."></span>

Joe P
0
 

Author Comment

by:azyet24
ID: 17076155
Ok BogoJoker, that worked.  Thanks.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

827 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question