473,382 Members | 1,622 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Get trouble to show progress status

Hello all..

merry christmas.. :)

I need to show progress status when a button is clicked.
I use this script. but I know that this code is still very bad.

Expand|Select|Wrap|Line Numbers
  1. <html>
  2.  
  3. <head>
  4.   <title>Loading test</title>
  5.  
  6.   <script language="javascript">
  7.     function Process() {
  8.       document.write("Please wait...");
  9.       location.href="index.php?page=main&action=process";
  10.     }
  11.   </script>
  12.  
  13. </head>
  14.  
  15. <body>
  16. <form>
  17. <input type="button" value="Process" onclick="Process();">
  18. </form>
  19.  
  20. </body>
  21.  
  22. </html>
  23.  
When I click BACK button, then it show 'Please wait..' without any direct. very ugly. :(

How to put the correct way to show a progress status?

Thank you very much.

best regards.
Dec 26 '07 #1
4 2725
Using document.write is not possible after the page has loaded since it will wipe the entire page and any scripts in it.

to fix your code instead update the innerHTML of a div on the page
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3.   <title>Loading test</title>
  4.   <script language="javascript">
  5.     function Process() {
  6.       document.getElementById('msg').innerHTML="Please wait...";
  7.       location.href="index.php?page=main&action=process";
  8.     }
  9.   </script>
  10. </head>
  11. <body>
  12. <form>
  13. <input type="button" value="Process" onclick="Process();">
  14. </form>
  15. <div id="msg"></div>
  16. </body>
  17. </html>
  18.  
However that will not necessarily work since changing the location unloads the page too...

Perhaps you can explain what you REALLY are doing - if you have a long server process you might want to use an iframe for the process and have some animated gif above the iframe...
Dec 26 '07 #2
Hi.. thank you very much for the fast reply.

I have a form. When submit button is pressed, I need to show progress status while form data is processed.

Yes true, I need a gif animation. How to use iframe?

Could you give me the example?

I think it's very simple perhaps. Just show progress status/animation while form data is being processed. :)

Thank you very much in advance.
Dec 26 '07 #3
You have two ways
1. if you need TRUE progress status you need a lot more complex setup depending on server since you need a separate thread on the server to monitor the first
2. just show a gif and remove it when the server returns with the result - here I use a "hidden" iframe and add something to the gif to make it not cache:

Expand|Select|Wrap|Line Numbers
  1. <form target="iframe1" action="..." method="get" 
  2. onSubmit="document.animation.src='pleasewait.gif?'+new Date().getTime()">
  3. .
  4. .
  5. </form>
  6. <img name="animation" src='blank.gif">
  7. <iframe width="1" height="1" name="iframe1" src="about:blank"></iframe>
  8.  
then in the server process which has to come from the same server as the page with the form you return
Expand|Select|Wrap|Line Numbers
  1. <script>
  2. parent.document.animation.src='blank.gif';
  3. </script>
  4.  
Dec 26 '07 #4
thank you very much for the helps.

you helping me so much.

thank you. :)
Dec 26 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: mirandacascade | last post by:
O/S - Windows XP Home with Service Pack 2 Vsn of Python: 2.4 (from ActiveState) This question is with regard to the progress bar controls that are in the file status.py. On my workstation,...
2
by: Champika Nirosh | last post by:
Hi All, Is there a way to add a Progress bar or any other control to a Status bar? Nirosh.
8
by: Randy | last post by:
Hi, is it possible to show the progress of a big file being copied e.g. in a "progressbar"? I tried to use file.copy - but this seems to make no sense :-( Thanks in advance, Randy
4
by: Kenneth Keeley | last post by:
Hi, I have a page that uploads files to my server and I wish to display a "Please wait while uploading" page to the user while the file is uploading. I have been able to redirect the user once the...
2
by: Robert Smith | last post by:
Hello, I have a problem with my progress bar, as shown in the attached code, the values on the bar are incremented within a threaded timer event. The timer works fine and ticks all the way...
6
by: Marko Vuksanovic | last post by:
I am trying to implement a file upload progress indicator (doesn't have to be a progress bar) using atlas... I do realize that the indicator cannot be implemented using Update panel control, but is...
1
by: Riky | last post by:
hi i have a windows application. I am select the folder or file name from the folderbrowserdialog box and to delete the folder or file i am calling the following code. Public Function...
2
by: PhilOwens | last post by:
Morning/Afternoon all, Having slight problem with showing users the progress of a query..... Bit of background....The database allows users to view the status of documents i.e. Completion date,...
6
by: Michael | last post by:
I need to copy a huge file (around 300Mb) from a mapped network drive to another. I have created a console application and used System.IO.File.Copy function. But I want to know the process of...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.