Solved

pop up windows

Posted on 1998-05-08
8
519 Views
Last Modified: 2013-11-28
I have tried the following two codes to get a pop up window that will display a definition. I have two examples with a question for each below.  Thanks for your help!
-----------------------------------
My problem in example #1 below is that the alert box (pop up window) plays a sound (alert sound) on the Mac Computers who view it.  

QUESTION:
What can I add to the code so users don't hear the sound
and
How can I define the size and location of the alert window (or is that not possible)
------------------------------------
Example#1

<CENTER><FORM><INPUT TYPE="button" Value=" Software  "
           onClick="alert('This is my definition of the work "software"')")>
      </TD>
-------------------------------
My problem in example #2 below is that the pop up window does not stay on the top (forefront).  If someone double clicks the button then the pop up window can't be seen as it is behind the main window.  Also if the user clicks anywhere on the main window after a pop-up window is displayed the pop up goes to the background and when the user clicks on other "pop up window buttons" the pop up window does not come to the foreground unless it had been closed.  

QUESTION:
What can I add to the code so users will always get the pop up window in the foreground even if the previous window is lurking in the background.

------------------------------------
-------------------------------
Example#2

      <TD>
         <CENTER><FORM ACTION="" METHOD=POST name=myform>
            <P><INPUT TYPE=button NAME=Button1 VALUE="      Hardware      " onclick="window.open ('descript/hardware.htm', 'newWin', 'scrollbars=no,status=no,width=200,height=200')">
         </FORM></CENTER>
      </TD>
---------------------------
I would like my solution to work on 3.O browsers and above (it would be great to work on 2.0 and above
-------------------------------
-------------------------------
0
Comment
Question by:calley
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 28

Expert Comment

by:sybe
ID: 1277568
put this in the html code for the popup window
<body ... onLoad="this.focus()">
0
 

Author Comment

by:calley
ID: 1277569
sybe,

Please give me more direction on where to add your code:

put this in the html code for the popup window
    <body ... onLoad="this.focus()">

---------------------
Where does that go in the following code:

<FORM ACTION="" METHOD=POST name=myform>
                <P><INPUT TYPE=button NAME=Button1 VALUE="      Hardware      "
    onclick="window.open ('descript/hardware.htm', 'newWin',
    'scrollbars=no,status=no,width=200,height=200')">
             </FORM>
0
 

Expert Comment

by:btphelps
ID: 1277570
Focus() is not supported by IE.

Brian
0
Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

 

Expert Comment

by:btphelps
ID: 1277571
Focus() is not supported by IE.

Brian
0
 
LVL 75

Expert Comment

by:Michel Plungjan
ID: 1277572
1. Alerts play sounds - that is what they are made for

2. you second example is ok, you need to put the following in the
descript/hardware.htm file:

<HTML>
<HEAD>
<TITLE>hardware<TITLE>
</HEAD>
<BODY ONLOAD="if (self.focus) self.focus(); else alert('Hardware');>

Here is all you ever wanted to know about hardware
</BODY>
</HTML>

The construction above will bring the window to front in NS2.x and up and MSIE 3.x and up

0
 

Author Comment

by:calley
ID: 1277573
I added the code suggested by mplungjan and got a syntax error.
---------------

Let me explain my problem more specifically and post the html files in question below.  Please load these files and try your solution out.  I would like the solution to work on Netscape 3.0 and above (Netscape 2.0 and above would be even better along with it working on IE 3.0 or above):

I have a main file (called start.htm) with 3 java buttons.  Each button take the user to a pop up window when clicked.  

The problem is that the pop up window does not stay on the top (forefront) after it first appears if at all.  If someone double clicks the button then the pop up window can't be seen as it is behind the main window (the second click does that).  Also if the user clicks anywhere else on the main window after a pop-up window is displayed, the pop up goes to the background and when the user clicks on other "pop up window buttons" the pop up window does not come to the foreground unless it had been closed.  

    QUESTION:
What can I add to the code so users will always get the pop up window in the foreground even if the previous window is lurking in the background or when the user clicks somewhere on the main winddow the pop up window does not go to the background?

Here are two files that will provide you with what you need to test your solution.  Thank you!

start.htm
--------------
<HTML>
<HEAD>
   <TITLE>Educational Resource Start Page</TITLE>
   <META NAME=GENERATOR CONTENT="Claris Home Page 3.0">
   <X-CLARIS-WINDOW TOP=42 BOTTOM=477 LEFT=4 RIGHT=534>
   <X-CLARIS-TAGVIEW MODE=minimal>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<CENTER><FONT SIZE="+2" COLOR="#FF0000"><B>Start
Page</B></FONT><TABLE BORDER=0 HEIGHT=128>
   <TR>
      <TD COLSPAN=3>
         <CENTER>Here are the categories to choose from:</CENTER>
      </TD>
   </TR>
   <TR>
      <TD>
         <P><FORM ACTION="" METHOD=POST name=myform>
            <CENTER><INPUT TYPE=button NAME=Button1 VALUE=" Software  " onclick="window.open ('software.htm', 'newWin', 'scrollbars=no,status=no,width=200,height=100')"></CENTER>
         </FORM></P>
      </TD>
      <TD>
         <P><FORM ACTION="" METHOD=POST name=myform>
            <CENTER><INPUT TYPE=button NAME=Button1 VALUE="      Hardware      " onclick="window.open ('hardware.htm', 'newWin', 'scrollbars=no,status=no,width=200,height=200')"></CENTER>
         </FORM></P>
      </TD>
      <TD>
         <P><FORM ACTION="" METHOD=POST name=myform>
            <CENTER><INPUT TYPE=button NAME=Button1 VALUE="Research" onclick="window.open ('research.htm', 'newWin', 'scrollbars=no,status=no,width=200,height=200')"></CENTER>
         </FORM></P>
      </TD>
   </TR>
 
</TABLE>
</CENTER>
</BODY>
</HTML>
------------
------------

hardware.htm
-----------
<HTML>
<HEAD>
   <TITLE>Hardware Description</TITLE>
   <META NAME=GENERATOR CONTENT="Claris Home Page 3.0">
   <X-CLARIS-WINDOW TOP=66 BOTTOM=480 LEFT=8 RIGHT=538>
   <X-CLARIS-TAGVIEW MODE=minimal>
</HEAD>
<BODY BGCOLOR="#FFFFFF">
<P><FONT SIZE="+1">Great hardware technology tools for educators:
Computers, PDA's, Printers, Scanners, Digital Cameras, modems,
etc.</FONT></P>

<P><FORM ACTION="" METHOD=POST>
   <CENTER><INPUT TYPE=button NAME=Button VALUE="Close" onclick="self.close()"></CENTER>
</FORM></P>
</BODY>
</HTML>
---------------

Thanks again!!


0
 
LVL 75

Accepted Solution

by:
Michel Plungjan earned 120 total points
ID: 1277574
<BODY ONLOAD="if (self.focus) self.focus(); else alert('Hardware');">

Sorry I forgot a closing quote after alert('Hardware');"  

Michel
0
 

Author Comment

by:calley
ID: 1277575
Thank you!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
Learn how to set-up custom confirmation messages to users who complete your Wufoo form. Include inputs from fields in your form, webpage redirects, and more with Wufoo’s confirmation options.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question