Solved

Javascript new window using an image as hyperlink

Posted on 2006-07-10
6
261 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
What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

 
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

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 …
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…

757 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

14 Experts available now in Live!

Get 1:1 Help Now