PDA

View Full Version : One popup window - modifications


allyson
07-19-2002, 05:28 AM
Hi

This function opens up one popup window, and can load different images into the same window. I would like to be able to control the background color of the popup window. Can anyone help? To see this in action, look at http://homepages.ihug.co.nz/~usateden/panacea/gallery/

I have also discovered that when the function is called up in netscape, the popup window does everything it's supposed to, except the image does not display, but it works well in IE. I would like it to work in both browsers.

<script language="javascript">

function picture(pic,desc){
var no=" addrbar=0,toolbar=0,location=0,directories=0,"
no+="status=1,menubar=0,scrollbars=0,resizeable=0,"
no+="width=720,height=576"





var mywin=window.open("","def",no)

mywin.document.write("<center><img src='"+pic+"'>")
mywin.document.write("<BR>", desc)
mywin.document.write("<BR>")
mywin.document.write("<input type='button' value=' Close Window ' onclick='javascript:window.close()'>")

}
</script>
</head>

<body>

<a href="javascript:picture('image.jpg', 'd


bye
Allyson

x_goose_x
07-19-2002, 06:58 AM
<script language="javascript">

function picture(pic,desc,bg){

vals = "addrbar=0,toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=0,resizeable=0,width=720, height=576"

mywin=window.open("","def",vals)

pophtml = "<body bgcolor='"+bg+"'>";
pophtml += "<center><img src='"+pic+"'>";
pophtml += "<BR>", desc;
pophtml += "<BR>";
pophtml += "<input type='button' value=' Close Window ' onclick='java script:window.close()'>";
pophtml += "</body>";

mywin.document.write(pophtml)

}
</script>
</head>

<body>

<a href="javascript: picture('image.jpg','desc','red');"></a>

allyson
07-19-2002, 08:21 AM
Hi

Thank-you for the new script. The popup window opens up, but it's totally blank, with a white background. It doesn't seem to understand the pophtml variables. Can you help me to get this working. http://homepages.ihug.co.nz/~usateden/panacea/gallery

function picture(pic,desc, bg){
var no=" addrbar=0,toolbar=0,location=0,directories=0,"
no+="status=1,menubar=0,scrollbars=0,resizeable=0,"
no+="width=720,height=576"





var mywin=window.open("","def",no)

mywin=window.open("","def",no)

pophtml += "<body bgcolor='"+bg+"'>";
pophtml += "<center><img src='"+pic+"'>";
pophtml += "<BR>", desc;
pophtml += "<BR>";
pophtml += "<input type='button' value=' Close Window ' onclick='java script:window.close()'>";
pophtml += "</body>";

mywin.document.write(pophtml)

}
</script>
</head>

<body background="../images/bgpalette3.GIF">

<a href="javascript:picture('../Cards/Flowers for Elizabeth.jpg', 'Flowers for Elizabeth','black')

x_goose_x
07-19-2002, 02:10 PM
<script language="javascript">

function picture(pic,desc,bg){

vals = "addrbar=0,toolbar=0,location=0,directories=0,"
vals += "status=1,menubar=0,scrollbars=0,resizeable=0,"
vals += "width=720,height=576"

mywin = window.open("","def",vals)

pophtml = "<html><body bgcolor='"+bg+"'>";
pophtml += "<center><img src='"+pic+"'>";
pophtml += "<BR>";
pophtml += desc;
pophtml += "<BR>";
pophtml += "<input type='button' value=' Close Window ' onclick='window.close()'>";
pophtml += "</body></html>";

mywin.document.write(pophtml)

}
</script>
</head>

<body>

<a href="javascript: picture('image.jpg','desc11','red');">open</a>

Tested and works.

allyson
07-20-2002, 01:15 AM
Hi

Thank-you for this script.

It works in IE, but in Netscape the popup window opens, the background colour changes, but the image does not appear and neither does the "close window" button. The image appears as the icon which means that the image cannot be found. The code is used in the link below:

http://homepages.ihug.co.nz/~usateden/panacea/gallery

Can anyone work out why it does not work in Netscape.

bye
Allyson

x_goose_x
07-20-2002, 01:38 AM
Works fine in ie4+ ans NS6

bacterozoid
07-20-2002, 01:41 AM
I didn't really read any of the replys, but as for it not working in Netscape, there isn't too much you can really do. IE and NN support most of the same parts of JS, but IE supports things NN doesn't, and NN supports things IE doesnt. I figure they work with each other and make it all the same so us web builders don't run into cross-browser compatibally errors.

Owl
07-20-2002, 02:05 AM
Hi Allyson,

mywin.document.write(pophtml)
mywin.document.close()

( •) (• )
>>V