Click to See Complete Forum and Search --> : pop up window


Anja
07-15-2003, 06:33 PM
Can anybody recommend a script for a pop up window (specified size) that works in IE5+ as well as Netscape 4+?
Anja

Charles
07-15-2003, 08:16 PM
<a href="http://www.w3.org/" onclick="window.open(this.href, 'child', 'height=400,width=300'); return false">W3C</a>

Khalid Ali
07-15-2003, 08:18 PM
trhe line below will open a window

<a href="http://www.w3c.org" onclick="window.open('http://www.w3c.org','newWin','width=400,height=300');return false;">Open W3c In New Window</a>

Anja
07-15-2003, 09:24 PM
Thanks for the scripts. Is there a possibility to have the pop up window open in the middle of the screen? Again, it needs to work both in IE5+ and Netscape 4+.

zuzupus
07-16-2003, 06:19 AM
use this one

onclick="window.open('thewindow.html','newWin','width=150,height=130,top=525,left=800,dependent=yes,alwaysRai sed=yes,resizable=1')" width="16" height="16" border="0" alt="Edit Text"></a>

let me know is it ok

Charles
07-16-2003, 06:37 AM
That will only work if the screen is 1900 x 1310 pixels in size and it will give you unacceptable results in Opera - sometimes. And the A element has no "alt" attribute.

<script type="text/javascript">
<!--
function newWin (url, height, width) {
if (navigator.appName == 'Opera') return true;
var geom = 'scrollbars';
geom += ',height=' + height;
geom += ',width=' + width;
geom += ',top=' + Math.round((screen.height - height) / 2);
geom += ',left=' + Math.round((screen.width - width) / 2);
window.open (url, 'child', geom);
return false;
}
// -->
</script>

<a href="http://www.w3.org/" onclick="return newWin (this.href, 400, 300)">W3C</a>

Anja
08-26-2003, 02:18 AM
Hi Charles

I tried your code and it works fine in IE6, but in Netscape® Navigator 4.08 I get this message:

HTTP Error 404
404 Not Found

Here is the URL to the page: http://www.nsw.redcross.org.au/pages/g3wineclub_2.html
The link is "Tyrrell’s Vat 47 Hunter Chardonnay 2000".

Anja

Charles
08-26-2003, 05:26 AM
That's a bit odd. Are you sure that version of Netscape can find the page when you remove the JavaScript?

zuzupus
08-26-2003, 05:31 AM
i agreed with charles im sure that u wont get any Jscript error in netscape

dragle
08-26-2003, 09:32 AM
Hi Anja,

The 404 error isn't coming from the newWin script; it's coming from the style sheet of your requested page. NS4.x will report a 404 error if you link to an external style sheet that doesn't exist. I.E., in the page you are loading in the new window you have this:


<link rel="stylesheet" href="../styles.css">
<title>Australian Red Cross NSW Wine Club</title>
<link rel="stylesheet" href="styles.css">


It's the second reference to styles.css that's triggering the problem, there isn't a copy of that file in the same directory as the page and thus the 404 is triggered.

Cheers!

Anja
08-26-2003, 08:46 PM
Thanks guys!
It was indeed the missing style sheet link that caused the error in Netscape.