/    Sign up×
Community /Pin to ProfileBookmark

pop up window

Can anybody recommend a script for a pop up window (specified size) that works in IE5+ as well as Netscape 4+?
Anja

to post a comment
JavaScript

10 Comments(s)

Copy linkTweet thisAlerts:
@CharlesJul 16.2003 — [font=monospace]<a href="http://www.w3.org/" onclick="window.open(this.href, 'child', 'height=400,width=300'); return false">W3C</a>[/font]
Copy linkTweet thisAlerts:
@Khalid_AliJul 16.2003 — 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>
Copy linkTweet thisAlerts:
@AnjaauthorJul 16.2003 — 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+.
Copy linkTweet thisAlerts:
@zuzupusJul 16.2003 — use this one

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

let me know is it ok
Copy linkTweet thisAlerts:
@CharlesJul 16.2003 — [font=georgia]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.[/font]

[font=monospace]<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>[/font]
Copy linkTweet thisAlerts:
@AnjaauthorAug 26.2003 — 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
Copy linkTweet thisAlerts:
@CharlesAug 26.2003 — [font=georgia]That's a bit odd. Are you sure that version of Netscape can find the page when you remove the JavaScript?[/font]
Copy linkTweet thisAlerts:
@zuzupusAug 26.2003 — i agreed with charles im sure that u wont get any Jscript error in netscape
Copy linkTweet thisAlerts:
@dragleAug 26.2003 — 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:

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


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!
Copy linkTweet thisAlerts:
@AnjaauthorAug 27.2003 — Thanks guys!

It was indeed the missing style sheet link that caused the error in Netscape.
×

Success!

Help @Anja spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.25,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...