Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Javascript new window using an image as hyperlink

Posted on 2006-07-10
6
Medium Priority
?
269 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 17

Accepted Solution

by:
BogoJoker earned 1000 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Enroll in October's Free Course of the Month

Do you work with and analyze data? Enroll in October's Course of the Month for 7+ hours of SQL training, allowing you to quickly and efficiently store or retrieve data. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

A while back, I ran into a situation where I was trying to use the calculated columns feature in SharePoint 2013 to do some simple math using values in two lists. Between certain data types not being accessible, and also with trying to make a one to…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
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…

610 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