[vox-tech] [OT] JavaScript / HTML Help: Popup windows and forms

Rod Roark rod at sunsetsystems.com
Fri Sep 10 22:08:56 PDT 2004


On Friday 10 September 2004 07:36 pm, Richard Crawford wrote:
> I've seen this done, so I know it's possible.  What I'd like to be able 
> to do is the following:
> 
> Have a main browser window, say index.php.  On this page is a list of 
> names or other information plus a link that reads "Add your name". 
> Clicking on the link opens up a popup window

This is not hard.  If you want to use window.open() to
control the attributes and location of the popup, try
something like:

  <a href="dummy.html" onclick="window.open(...); return false">

where dummy.html might be a page that displays "your browser
does not support JavaScript" or some such.

> with a form for users to  
> enter their information.  When they click "submit", then the form 
> information is submitted, the popup window closes, and the main page 
> refreshes to show the new added information.

There are a few different ways to refresh the main page from
a child window with JavaScript, depending on what you need;
for example:

  opener.document.forms[0].submit();

It's also possible to rewrite sections of a page directly
(without making a request to the server) which is pretty
cool, but that's a bit trickier.

-- Rod


More information about the vox-tech mailing list