List Info

Thread: Re: Delay for progressbar onSubmit




Re: Delay for progressbar onSubmit
country flaguser name
United States
2007-05-22 09:25:40

This is a common problem. The solution is not so straight-forward.

The problem is that, when a page is "unloaded", the Javascript goes
away with it. This is usually before the next page is fully "loaded".
I've been on projects where this issue was addressed, and here is what
we did:
1) The progress bar is created in a completely different window
through a JavaScript global variable:
var progress = window.open (...);
2) The second window is opened as a child of the first:
window.open ("second.html");
3) The second window, in it's onLoad handler, destroys the progress
bar and the first window:
window.opener.document.progress.close ();
// NOTE EVERYONE: please correct me if I'm wrong!!!
window.opener.close ();

There will be a flash as 2 opens and 1 closes, but at least this will
work fully.

--Tim Sabin

> Hello. I haven't gotten around to learning js yet, so I found the
script that I needed online. I
> actually combined it with another to make what I need, which is that
when you click on a
> button or a link or something like that, if you have specified a
certain href (for the link) or
> onSubmit (for a form) or onClick (for a specific button, ie submit
in the form) it pops up a
> processing bar. I want to add this to certain pages so that when
you click the submit button,
> the js progress bar shows for about 2 seconds, and then it goes to
the page that the form's
> action attribute specified, carrying whatever form data it needs. I
want to be able to use post
> or get as my method. All of this works fine, if, instead of a
submit button, I use a regular
> button, because I'm not specifying an action, so the clicking of the
button just launches the
> processing bar. When I have an action and a button that sends the
form data, such as
> submit, I run into my problem: the processing bar pops up for a
moment and freezes,
> because the next page is starting to load, so even though the old
page is still there for a few
> seconds while the new page loads, the javascript processing bar is
still there, but not moving.
> How do I get this to work correctly, which once again, is that the
user presses the submit
> button, the processing bar shows for about two seconds, and then
it's okay if it freezes after
> the two seconds while the page loads. The page is located at
http://softworksdesign.com/
> progress_bar_test.html and you can look at the source to find the
locations of the js
> documents and where they are in the page. Thank you!
>;
>
>
> Visit http://aiaiai.com for more groups to join
> Yahoo! Groups Links
>
>
>
>
>

__._,_.___
.

__,_._,___
[1]

about | contact  Other archives ( Real Estate discussion Medical topics )