Solved

Javascript new window using an image as hyperlink

Posted on 2006-07-10
6
262 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

In this article, we'll look how to sort an Array in JavaScript, including the more advanced techniques of sorting a collection of records either ascending or descending on two or more fields. Basic Sorting of Arrays First, let's look at the …
This article discusses the difference between strict equality operator and equality operator in JavaScript. The Need: Because JavaScript performs an implicit type conversion when performing comparisons, we have to take this into account when wri…
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…

920 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now