Javascript question

Mondeo

Centurion
Joined
Nov 10, 2006
Messages
128
Location
Sunny Lancashire
I have a products page containing an image, theres also a button to enlarge image. I want this to be a new window just containing the image, like a popup.

In my page load i've got

Response.Write("<script>self.resizeTo(285,439)</script>")

This looks okay but could do with improvement. How can I get just a plain window, no scrollbars, no address bar etc.

Can it be done?

Thanks
 
Popup window options

When your main page launches the popup window it can specify things like size and whether to display scrollbars and toolbars. The window.open method takes 3 parameters - the URL to launch in the new window, the name of the new window, and finally a string containing a list of window options. For example:

Code:
<script language="javascript"><!--
var url = "http://www.mysite.com";
var name = "popup_window";
var options =
  "height=439," +
  "width=285," +
  "directories=no," +
  "location=no," +
  "menubar=no," +
  "resizable=no," +
  "status=no," +
  "toolbar=no," +
  "scrollbars=no," +
  "left=10," +
  "top=10";

var wnd = window.open(url, name, options);
wnd.focus();
//--><script>

Most of the options are self explanatory.

Good luck :cool:
 
Thanks for that. That solves the product page problem.

One other question we also have a page very similar to the products page which functions as an ebay template for advertising products on ebay.

It also has the enlarge button but I know that ebay does not allow javascript.

So is it possible to manipulate the new page (either with or without using javascript) as its opening?

Thanks
 
Re: Popup window options

If you want something a little fancier you can check out

http://ajaxian.com/archives/lightboxjs-easy-image-overlays-with-javascript
or
http://ajaxian.com/archives/lightbox-v20-released
or
http://ajaxian.com/archives/modal-dialog-lightbox-goes-wild

The website to get the code seems to be down right now but you can download it and see an example (of the first version at least) from my website if nothing else. If you are having a hard time tracking down all the files you need, let me know and I can zip everything up and post it here for you. (This example is the purchase page, but please don't feel like I'm trying to make a hard sell for anything. This is just an example of the lightbox.js so you can see it because the original website appears to be down at the time of my writing this.)

Version 1 (the version I use) is simple javascript. Version 2 I believe uses prototype and script.aculo.us. The third link (version 2 alternate) uses moo.fx.
 
Back
Top