Javascript syntax for opening a new window based on image rotator selection

Posted on 2008-01-30
Medium Priority
Last Modified: 2012-05-05
I use links like this to open enlarged images in a new window, it works very well:

<A HREF="javascript:openWin('_enlarge.asp?file=ph_ex3_console','800','600')">

The 800 and 600 let me specify the size of the window. However, I need to call this same function from a Javascript which lets the user rotate through images in a slideshow, and click the one they are on to enlarge. Here is what it looks like:

openWin('_enlarge.asp?file=' + document['currentimg'].src);

It basically works, except I cannot find the correct syntax to insert the 800 and 600. I tried this but it does not work:

openWin('_enlarge.asp?file=' + document['currentimg'].src + '800,600');

I guess its just a syntax problem, I don't know how to specify those parameters with the single quotes.

Thank you.
Question by:Brad Bansner
LVL 23

Expert Comment

by:Ashish Patel
ID: 20778180
use like this and check.
<A HREF="javascript:window.open('_enlarge.asp?file=ph_ex3_console', 'winname', 'width=800, height=600');">

Accepted Solution

toddbehnke earned 2000 total points
ID: 20778526
try removing any and all white spaces in the call such as
openWin('_enlarge.asp?file=' + document['currentimg'].src + '800,600');


Author Comment

by:Brad Bansner
ID: 20778851
Thank you, I got it to work now.

Featured Post

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.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…

627 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