JS help

They have: 34 posts

Joined: Oct 2001

hello-

i'm trying to get this script to have each thumbnail on my site open up in an html page, without making the html page for each thumnail.

does this make sense?

does the script?

---in head---
<script language="javascript">

</script>

---in body---

thanks.

mmi's picture

They have: 457 posts

Joined: Jan 2001

hey getyourbiglobst - yer script works - you might want to set other attributes for the pop-ups, e.g., width and height - is there anything about the function that you want to "fancy up?" - e.g., you could have the windows sized to fit the dimensions of the larger images


Web Xpertz Community Forums for Webmasters & Developers

Where You Can Learn, Advise, and Have Fun in the Process

Busy's picture

He has: 6,151 posts

Joined: May 2001

Its the same method as if you were opening a html page, just swap the file names. and images usually have the tolbar, scrol bar etc set to 0

but using the width and height tags for this new window can have problems. As different browsers have different default margin settings, the picture can be cut off bottom/right with a white gap top/left, so always make the pop up bigger than needed or just use a basic html page with margins at 0

or you can write the html page within the code:

&lt;script ...&gt;
function popimage(){
htmlCode =
    '<html><head><title>popup</title></head>'
  + '<body .....
....
+ '</body></html>
}
&lt;/script&gt;
'
and your link would be:
<a href="javascript:popimage()">'

or inline:

<a href="javascript:openPopWin('image.jpg', 250, 195,
'menubar,scrollbars,resizable,status')">link</a>
'
among other ways

edit: cant get rid of the dang smiles, top one is ": p" no space and second one is ": o" no space

Suzanne's picture

She has: 5,507 posts

Joined: Feb 2000

I checked the "Disable Smilies in This Post" checkbox in the Options for you, Busy.

Smiling Suzanne

P.S. zerocattle.com/examples/popUp.html is based on the tutorials at irt.org, if your looking for a better popup code. You can easily add in the automatic writing of the HTML page if you want that.

I find adding 15 px to the size of the image (both height and width) leaves a fairly nice border around the image in IE5, but each browser leaves a different border, so that's not foolproof.

P.P.S. You could also use a combination of server-side scripting and javascript to pop the image into a template.

Busy's picture

He has: 6,151 posts

Joined: May 2001

Thanks, I'm always forgetting about that option Laughing out loud

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.