× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.


  • Subject: RE: Popup Help
  • From: "Mike Krebs" <mkrebs@xxxxxxxxxxxxxxxxxx>
  • Date: Fri, 25 Aug 2000 15:14:34 -0500
  • Importance: Normal

Michael,
I think this is what you are looking for. This e-newsletter has the script
that will popup an alert box. There is much more at www.javaworld.com or
www.javascript.com.
Mike Krebs

JAVASCRIPT --- August 01, 2000
Published by ITworld.com, the IT problem-solving network
http://www.itworld.com/newsletters

*********************************************************************
HIGHLIGHTS

* Alert visitors that something is happening but please, don't abuse the
  dialoge box

Red (or Blue, or Green) Alert
Generating Alert Dialog Boxes
by David Wall

Many people's first experience with JavaScript on the Web is a dialog
box generated by JavaScript. "Whoa!" they say, "JavaScript is the way to
make my Web pages look like regular applications!" Well, maybe the
reaction doesn't go quite like that, but most people do first take note
of JavaScript when it creates a dialog box of some kind.

JavaScript's dialog boxes are modal. That means that when they're
created, they hop to the foreground in front of your browser window and
won't let you get back to your browser until you manually clear the
dialog box. So what? Well, that's annoying, especially if dialog boxes
pop up any more frequently than once in a while. It's worse than
annoying for the people who build spiders that navigate the Web
automatically. Spiders, which are supposed to get around without human
intervention, can get hung up on dialog boxes. The moral:  Use dialog
boxes sparingly.

The other thing you may want to know about JavaScript dialog boxes is
why they all say "JavaScript Alert:" or "JavaScript Confirm:" in them.
There's no way to get rid of these messages, and the reason is security.
The logic of the designers of the JavaScript interpreter is that without
the JavaScript notice in the dialog boxes, unscrupulous programmers
could make dialog boxes that looked like they belonged to some program
other than your browser, potentially fooling you into doing something
you didn't want to do.

JavaScript's Alert dialog box displays a message and a single OK button.
All you can do when an Alert dialog box appears on your screen is click
the OK button to get rid of it. There's no chance for input, debate, or
disagreement. You have to say OK and get on with it.

You may want to use the Alert dialog box to, well, alert your surfer
that something is going on. You can tell the surfer that something is
being calculated or display the result of the calculation in a
more-dramatic-than-usual way.

This program clues you in to the basic syntax involved in creating the
Alert dialog box. It doesn't do much of use, but you'll be ready to use
the Alert dialog box for more practical applications after doing this
exercise.

‹HEAD›
‹TITLE›Red Alert‹/TITLE›

‹SCRIPT LANGUAGE=JavaScript›
‹!-- Engage cloaking.
function Alert()
{
//Responds to onClick event.
window.alert("I told you not to click the button!")
}
//Disengage cloaking--›
‹/SCRIPT›

‹/HEAD›
‹BODY›
‹HTML›
‹H1›Whatever you do, don't click the button.‹/H1›
‹FORM NAME=Button›
‹INPUT TYPE=BUTTON NAME=AlertButton VALUE="Don't Click Me."
onClick="Alert()"›
‹/FORM›
‹H2›Not ever.‹/H2›
‹/BODY›

The interesting part of this program appears in the function:

window.alert("I told you not to click the button!")

That statement causes an Alert window containing the words, "I told you
not to click the button!" to pop up over the browser window.


Resources

Java Tip 89: Manipulate EventQueues for semimodal dialogs
A technique to give users more freedom when modal dialogs are too
restrictive.
http://www.javaworld.com/javaworld/javatips/jw-javatip89.html

Java Tip 72: Press Escape to close your Swing dialog windows
Discover how to program keystroke responses in your Dialogs' parent
classes.
http://www.javaworld.com/javatips/jw-javatip72.html

JavaTip 69: Press Escape to close your Java dialog windows
Discover how to program keystroke responses in your Dialogs' parent
classes.
http://www.javaworld.com/javatips/jw-javatip69.html

************************************************************************

About the author
----------------
David Wall works as a freelance writer, programmer, lecturer, and
consultant. Based near Washington, D.C., David has written and
co-written several books, including Graphics Programming with JFC.
He enjoys traveling, sailing, woodworking, and literary nonfiction.His
woodworking habit has come in handy for building those much-needed
bookshelves in the Dave Cave. He can be reached at
david.wall@javaworld.com.


Copyright 2000 ITworld.com, Inc., All Rights Reserved.

http://www.itworld.com


-----Original Message-----

I have a java servlet on the as400 that is running several web pages. What I
would like to do is, based on a certain response send out a popup with some
text and an "ok" button to close it. Does anyone know where I can get code
examples of this in java (JavaScript?)

Thanks in Advance!

Michael P. Gibbons


+---
| This is the JAVA/400 Mailing List!
| To submit a new message, send your mail to JAVA400-L@midrange.com.
| To subscribe to this list send email to JAVA400-L-SUB@midrange.com.
| To unsubscribe from this list send email to JAVA400-L-UNSUB@midrange.com.
| Questions should be directed to the list owner: joe@zappie.net
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.