Solved

pop up windows

Posted on 1998-05-08
8
505 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
  • 3
  • 2
  • 2
  • +1
8 Comments
 
LVL 28

Expert Comment

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

Author Comment

by:calley
Comment Utility
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
Comment Utility
Focus() is not supported by IE.

Brian
0
 

Expert Comment

by:btphelps
Comment Utility
Focus() is not supported by IE.

Brian
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 75

Expert Comment

by:Michel Plungjan
Comment Utility
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
Comment Utility
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
Comment Utility
<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
Comment Utility
Thank you!
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Read about why website design really matters in today's demanding market.
Read about the 3 stages of the buyer's journey: awareness, consideration, and decision.
An overview of how to create reports in Adobe Analytics (formerly Omniture Site Catalyst) using pageNames, events, eVars and props. This video will show you how to install the Omniture Debugger tool so can see (and test) what is being passed int…
Use Wufoo, an online form creation tool, to make powerful forms. Learn how to choose which pages of your form are visible to your users based on their inputs. The page rules feature provides you with an opportunity to create if:then statements for y…

763 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

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now