By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,069 Members | 1,716 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,069 IT Pros & Developers. It's quick & easy.

How to display "please wait.." after new window opens

P: n/a

Hi

I have a form that opens a new window for the results. Because the results
might take a few seconds due to server processing, I would like to display
a message "please wait" in the new window, erase that message when the
processing is done and show the results.

How is this done?

John Dalberg
Jul 23 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
John Dalberg wrote:
Hi

I have a form that opens a new window for the results. Because the results
might take a few seconds due to server processing, I would like to display
a message "please wait" in the new window, erase that message when the
processing is done and show the results.

How is this done?

John Dalberg


Hi,
Open a named window with a static page eg. wait.html (with the word
"Please wait..." on it)
The use windowName.document.write(Results) to replace the static page
with results.

Kien
Jul 23 '05 #2

P: n/a
On Wed, 04 Aug 2004 20:38:13 GMT, Kien wrote:
John Dalberg wrote:
Hi

I have a form that opens a new window for the results. Because the results
might take a few seconds due to server processing, I would like to display
a message "please wait" in the new window, erase that message when the
processing is done and show the results.

How is this done?

John Dalberg


Hi,
Open a named window with a static page eg. wait.html (with the word
"Please wait..." on it)
The use windowName.document.write(Results) to replace the static page
with results.

Kien


It doesn't work for me. This is what I am doing. You can view the
javascript, form and the button.

<SCRIPT LANGUAGE="JavaScript">
<!--
var msgWindow;
var sResults;
function newWin(){
sResults = QueryResults;
strFeatures='resizeable=no,width=800,height=600';
msgWindow=window.open('wait.htm','',strFeatures);
msgWindow.document.write(sResults)
msgWindow.focus();
}

This is the form:
<form Method="get" name="frmDomainCheck" action="whois.asp"
target="QueryResults">

This is the button:
<input type="submit" value="Check For Availability" class="whois"
onclick="newWin();return true">

J.
Jul 23 '05 #3

P: n/a
John Dalberg wrote:
Hi

I have a form that opens a new window for the results. Because the results
might take a few seconds due to server processing, I would like to display
a message "please wait" in the new window, erase that message when the
processing is done and show the results.

How is this done?

John Dalberg


-- on the page used to initate generation of the report:

<input type="submit" value="Generate Report" onclick="openStatusWindow();">
<script type="text/javascript">
function openStatusWindow() {
if (window.open) {
var throwAway = window.open(
'status.html',
'statusWindow',
'width=400,height=200'
);
}
}
</script>

-- status.html:

<html>
<head>
<title>Generating report... please wait</title>
<script type="text/javascript">
function holdFocus() {
var t = setTimeout(holdFocus, 1000);
window.focus();
holdFocus.toString = function() {
return 'holdFocus();';
}
}
</script>
</head>
<body onload="holdFocus();">
<p align="center">Generating report... please wait</p>
</body>
</html>

-- on the page containing the resulting report:

<body onload="closeStatusWindow();">
<script type="text/javascript">
function closeStatusWindow() {
if (window.open) {
var w = window.open(
'about:blank',
'statusWindow',
'width=400,height=200'
);
if (w && !w.closed) {
w.close();
}
}
}
</script>

It's necessary to call window.open() again on the window named "statusWindow".
If you do not, you will not have a reference (handle) to it, and will not be
able to close it. I tested it in IE6SP1, Netscape 4.78, Firefox 0.9.2 and
Opera 7.53 and it allowed me to open and close the window without holding a
reference to it.

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq

Jul 23 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.