homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member
Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

Question about document.layers
How can I use it to display a popup or an alert box?

WebmasterWorld Senior Member 10+ Year Member

Msg#: 707 posted 1:31 am on Aug 3, 2003 (gmt 0)


I've been having problems the past few days getting a page to look okay to NN4 users. Finally, I decided that making a page compatible with NN4x AND using CSS requires more knowledge than I have, and way too much time. But, I'm getting enough NN4 visitors that I feel I need to take them into account, at least by letting them know why the page doesn't look right to them.

Someone said that only NN4x recognizes document.layers. So my plan was to display an explanatory popup or an alert box using document.layers. I have a few questions about how I should procede.

First, is there any kind of popup stopper that works with NN4? A popup would really be my preference over an alert box, but with so many popup stoppers in use these days I wasn't sure if a popup was best. If no (or few) popup stoppers work with NN4, I'll probably skip the alert box and work out some sort of popup situation.

So, if I decide on a popup, how can I call it using document.layers? I've used a popup script before that I like, but it uses an external .js file. Can I use document.layers to call that file?

And, if I end up deciding on an alert box after all, is there any way to include links to modern browser upgrades in the alert box, and set it so the alert only shows up once per browser session?

If someone can answer some or all of these questions, or provide an alternative solution, I would greatly appreciate it. My knowledge of javascript is nominal, so I'm really relying on this forum for instructions! :)





WebmasterWorld Senior Member tedster us a WebmasterWorld Top Contributor of All Time 10+ Year Member

Msg#: 707 posted 3:20 am on Aug 3, 2003 (gmt 0)

Yes, pop-up blockers do work with Netscape 4. Many will not block the pop-up windows that are activated by a user action -- but quite a few will be that heavy-handed.

And since you will probably be automatically opening the new window, an Alert may be a more universal solution for you. No, you won't get an active hyperlink in there, but at least you can be sure to inform your users about what's happening.

All you need is:

if (document.layers) {
alert("Your Message Here")

or if you go with a pop-up window, call your pop-up function instead of the Alert:

if (document.layers) {

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved