?
Solved

Javascript new window using an image as hyperlink

Posted on 2006-07-10
6
Medium Priority
?
268 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
Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And 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

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

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

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…
This article discusses how to implement server side field validation and display customized error messages to the client.
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…

777 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