View Single Post
  #1 (permalink)  
Old September 9th, 2003, 04:24 PM
cppman cppman is offline
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