Javascript "alert()" acts modeless, p14
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!
|