Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old September 9th, 2003, 04:24 PM
Registered User
 
Join Date: Sep 2003
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Javascript "alert()" acts modeless

Using the following Javascript code (on Linux) produces different results depending on the browser. This code is closely related to that on page 14 of "Beginning Javascript" by Paul Wilton.

<HTML>
<HEAD> </HEAD>

<BODY BGCOLOR="GREEN">

    <P>Paragraph 1</P>

    <SCRIPT LANGUAGE="JavaScript">
        alert ("First Script Block");
        document.bgColor="BLUE";
    </SCRIPT>

    <P>Paragraph 2</P>

    <SCRIPT LANGUAGE="JavaScript">
        alert ("Second Script Block");
        document.bgColor="RED";
    </SCRIPT>

    <P>Paragraph 3</P>

</BODY>

</HTML>

-----------------------------------------------
When using Netscape (Linux), it does not halt at the "alert()" as it should (alert() should invoke a MODAL message box), but instead rushes along until it completes all the Javascript code, leaving all of the messageboxes on the screen, waiting for dismissal.

When using Konqueror, it halts correctly at the "alert()", but never changes colors, staying the original GREEN.
-----------------------------------------------------------

If I change from "alert()" to "confirm()", the Netscape run works, but I want an "alert()", not a "confirm()",because this is a different user interface. The Konqueror version using "confirm()" still fails to change colors.

I would certainly appreciate some help if anyone is familiar with this. Thanks!
Reply With Quote
  #2 (permalink)  
Old September 11th, 2003, 08:40 AM
Authorized User
 
Join Date: Jul 2003
Location: , , .
Posts: 46
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via ICQ to stalker Send a message via MSN to stalker
Default

maybe netscape doesn't treat alert msg boxes as modal. check it at http://devedge.netscape.com
try to make a function that halts the script... but why do you want a script like that!? it doesn't do a thing at all! :)

good luck

Reply With Quote
  #3 (permalink)  
Old September 16th, 2003, 09:52 AM
Registered User
 
Join Date: Sep 2003
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for your reply. netscape.com seems like a good place to look for this, since Netscape's compatibility is likely the issue here, rather than any fault with Javascript. However, I haven't found anything there yet.

The Javascript specification for the "alert()" function is that it activates a MODAL message box. To disregard this is to ignore the compatibility between browsers that the spec exists to provide. For Netscape to knowingly implement alert() as a modeless is unlikely. I suspect that it usually works correctly, but possibly there is a seemingly unrelated setting in Netscape that somehow causes this, and hopefully someone will share this here.

The purpose of alert() IS to halt the script, while the user is "alerted" to something. This is the definition of a modal message box. That is what it is there for, and there is no sense in hacking a "fix" that works for an aberrent browser, or a browser with goofy settings, but then causes trouble and irritation for the user with all other browsers.

The purpose of the "do nothing" script is to test the alert() function and the changing of background colors on different browsers, so that I can make a product that will work properly for any customer regardless what browser they use. What a radical concept! This is supposed to be standard operating procedure for all this web stuff, but unfortunately compatibility is often not achieved. Since it revealed this simple misfunction, then it clearly "did something".

Somewhere, someone knows the answer to this. And I am hoping they will find this and help.

Thanks.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
change text colors in an javascript Alert? larry Javascript How-To 5 February 12th, 2007 08:03 AM
PURE asp upload problem ., alert from Javascript kasanar ASP.NET 1.0 and 1.1 Professional 0 February 19th, 2005 10:06 AM
Javascript alert error Ed7777 Javascript How-To 5 June 25th, 2004 02:23 PM
Javascript alert box Adam H-W Javascript How-To 13 March 4th, 2004 05:11 AM



All times are GMT -4. The time now is 07:06 PM.


Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.