Closed Thread Icon

Topic awaiting preservation: simple javascript (Page 1 of 1) Pages that link to <a href="http://ozoneasylum.com/backlink?for=7901" title="Pages that link to Topic awaiting preservation: simple javascript (Page 1 of 1)" rel="nofollow" >Topic awaiting preservation: simple javascript <span class="small">(Page 1 of 1)</span>\

 
taxon
Neurotic (0) Inmate
Newly admitted
posted posted 10-22-2001 15:40

I'm trying to get an image to come up in a pop up window.
I have no probs with the window itself coming up.... but the image I want displayed inside of the window is not centered, and therefore it cannot fully be seen.
The link for the pop up window goes directly to the URL of the picture.
Do I have to put the picture into some html first in order to do this?.. or is there something I can do in order to get my pic to show up properly?

ZOX
Bipolar (III) Inmate

From: Southern Alabama, USA
Insane since: Sep 2000

posted posted 10-22-2001 15:45

You can use a javascript where you can set the size of the window you open up.
This is the one I use

function OpenWin(nurl,nwidth,nheight) {
popupWin = window.open(nurl, 'newwin', 'scrollbars,width=' + nwidth +',height=' + nheight)
}

And then a link like this:

<a href="JavaScript:OpenWin('picture.jpg',350,550)">

where the numbers in the link is the size of the window that I want.

lallous
Paranoid (IV) Inmate

From: Lebanon
Insane since: May 2001

posted posted 10-22-2001 16:45

you can do what ZOX told you, but that won't center the image instead it will just show the image exactly in the popup window.

If you don't want to use another HTML, you can build that HTML code on the fly:

code:
function pop(imgsrc)
{
w = window.open('', 'displaywindow', 'border=no,location=no,screenX=0,screenY=0,width=100,height=100');
d = w.document;
d.open();
imgtag = '<img name="img" src="' + imgsrc +'" onload="resizeTo(document.img.width + 50, document.img.height + 50);">';
d.write('<html><body bgcolor="black" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0"><table align=center><tr><td valign="middle" align="center">' + imgtag +'</td></tr></table></body></html>');
}
pop("http://www.OzoneAsylum.com/images/ASYLUM44b.jpg");



hope this helps a bit...


InI
Paranoid (IV) Mad Scientist

From: Somewhere over the rainbow
Insane since: Mar 2001

posted posted 10-22-2001 16:45

The poster has demanded we remove all his contributions, less he takes legal action.
We have done so.
Now Tyberius Prime expects him to start complaining that we removed his 'free speech' since this message will replace all of his posts, past and future.
Don't follow his example - seek real life help first.

taxon
Neurotic (0) Inmate
Newly admitted
posted posted 10-22-2001 16:56

That's the way I ended up doing it.... just put 'em in html files.
Thanks.


Gotta run... I'm on a mission to have my site up and running again..... SOOOOOOON ... *eerie music begins to play..*

Wakkos
Maniac (V) Mad Scientist

From: Azylum's Secret Lab
Insane since: Oct 2000

posted posted 10-22-2001 19:28

Hey Tax! I hopoe not to be too late, I found this, and maybe is useful for you:

code:
<script>
function popimage(imagesrc,winwidth,winheight){
var look='width='+winwidth+',height='+winheight+','
popwin=window.open("","",look)
popwin.document.open()
popwin.document.write('<title>Window's title here</title><body><table width="100%><tr><td align="center"><img src="'+imagesrc+'"><td></tr></table></body>')
popwin.document.close()
}

</script>



And then:
<a href="#" onclick="popimage('../imagenes/vajillas2.jpg',340,350);" return false>

« BackwardsOnwards »

Show Forum Drop Down Menu