I am unable to get my pop-up to resize or hide the toolbar when I select a thumbnail. I entered the width & height in my onclick event, bu that did not seem to work. I am guessing that I probably need to enter the attributes in the function and if so, where do they go?

Thanks for any assistance that you can provide!

<script type="text/javascript">
function openWindow(modelnum)

while ($myrow = mysql_fetch_array($myresult))
<td><a href='#' onclick='openWindow("<?php echo $myrow; ?>")'><img src='../images/products/<?php echo $myrow ["imgsm"]; ?>' border='0' /></td>

12 Years
Discussion Span
Last Post by langsor

The arguments to the window.open() function are: URL, Name, and Features.

URL is self-evident. Name is the name of the opened window, which can be used as an argument for the target attribute of hyperlinks.

Features is an optional list of characteristics of the new window:

For example:

<a href="myimage.gif" 
  onClick="window.open('myimage.gif', 'myWin', 
  'toolbar=no, directories=no, location=no, 
  status=yes, menubar=no, resizable=no, scrollbars=no, 
  width=300, height=200');">my image</a>


I am a little confused: this works only if you are calling a single img on a single page and not multiple img's from a single page (e.g. a catalog). Since multiple img's are called from the db, I wrote a function that would grab the img tied to the modelnum, hence my function is executed in the onclick event. So, do I include the attributes in the function or in the event?



Your question, as I understood it, was how to remove the toolbar from your opened window. My response was to show you that the window.open() function has an optional "features" parameter to control this.

You need to change this line in your code:


You are passing in "null" as a name, and leaving off the the feature string. Edit it to pass in the features you desire for the pop-up window.


By the way, many browsers now open pop-up windows as tabbed windows. Which means that you cannot hide the scrollbars of the main window... so if this is important you might try a different approach.

window {
overflow: hidden;

var body = document.getElementsByTagName('body').item(0);
body.style.overflow = 'hidden';
body.style.overflow = 'auto'; // back to normal

Just a thought

Oops, sorry ... I thought you were trying to hide the scrollbars -- my bad.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.