[H-GEN] need some html/javascript pointers (setting window attributes)
Michael Anthon
michael at anthon.net
Fri Jan 6 03:52:26 EST 2006
On 1/6/06, Tony Nugent <tony at linuxworks.com.au> wrote:
> Yes, this looks like the way that I'll have to resort to doing (my raw test code
> just about does that already). I'll try initially opening the (named) target
> window from the form in the parent window with onSubmit() - if that window
> doesn't already exist (perhaps testing for that isn't necessary, I'll have to
> experiment - is it ok to re-open an open window?) But at the same time, it
> means a bit of a re-design with how I've been doing it so far. Oh well. But
> once it's done, it's done. It's all modular in functions etc, so hopefully it
> shouldn't be too hard to achieve what I want (fingers crossed).
Using window.open(URL, name [, features]), as Glenn mentioned, is very
similar to using the target="name" in the form tag. Use the onSubmit
event to call a function that uses window.open with a name. If the
named window does not exist it is created, if it does exist it is
reused. Construct the URL by grabbing the fields you need to submit
and append them as the query part of the URL (essentially what you
would get with a form with method="GET"). The javascript to itterate
through a form and build a query string is relatively simple and there
should be many good examples you can nick. Remember to return false
from the onSubmit function so that the browser doesn't submit the form
as well.
Cheers,
Michael
More information about the General
mailing list