473,320 Members | 1,949 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,320 software developers and data experts.

Help with Javascript

Hi,
I have a Javascript function that loads a page with a progress bar for long
process. The progress bar is a gif animation and for some reason it the
animation is stuck when the function is called so it looks like an image and
not an animation. I have decided to put a wait function that will pause for 3
sec so that the animation will be loaded then the call the function for the
long process.

This is the <SCRIPT> section

<SCRIPT language="javascript">

<body MS_POSITIONING="GridLayout"
onload="pause('<%Response.Write(redirectPage)%>',' <%Response.Write(Request.Url.Query)%>','<%Response .Write(secondsToWait)%>','<%Response.Write(minutes ToWait)%>')">
var i = 0;

function redirectTo(targetPage, querystring, secondsForWaiting,
minutesForWaiting)
{
if (0 < targetPage.length)
{

location.replace(targetPage + querystring);

if (secondsForWaiting.valueOf() > 0)
{
msgLabel.innerText =
"This process can take up to "
+ secondsForWaiting + " seconds...";
timedIterations(secondsForWaiting);
}
else
{
if (minutesForWaiting.valueOf() > 0)
{
msgLabel.innerText =
"This process can take up to "
+ minutesForWaiting + " minutes...";
timedIterations(minutesForWaiting * 60);
}
}
}
else
{
msgLabel.innerText = "Page not found."
}
}

function timedIterations(secondsForIterating)
{
incrementalWidth = 800 / secondsForIterating;
if (i <= secondsForIterating + 10)
{
setTimeout(
"timedIterations(" + secondsForIterating + ");",
1000);
i++;
}
else
{

ProcessingLabel.innerText =
"The server is taking longer than "
+ "anticipated to process your request. "
+ "Thank you for your patience. "
+ "You can wait a few minutes longer for "
+ "the process to complete, or you can press "
+ "the back button and try again later...";
}
}

function pause(targetPage, querystring, secondsForWaiting,
minutesForWaiting)
{
setTimeout('redirectTo(targetPage, querystring, secondsForWaiting,
minutesForWaiting)',3*1000); <========== I am having the error here.
}


</SCRIPT>
this is the load event of my form

<body MS_POSITIONING="GridLayout"
onload="pause('<%Response.Write(redirectPage)%>',' <%Response.Write(Request.Url.Query)%>','<%Response .Write(secondsToWait)%>','<%Response.Write(minutes ToWait)%>')">

On the load event I call the pause() FUNCTION which then pause for 3 secs so
that the page with the animation is loaded then the pause() FUNCTION calls
the function the calls the page with the long process. The problem is when my
page loads and call the pause function I get the runtime error:
"A runtime error has occured

Line 74

Error: Unterminated string constant"

Any ideas?

Thanks

Nov 19 '05 #1
2 1445
You can enable JavaScript debugging on your local test machine. First, in
your browser, under Tools|Internet Options|Advanced tab, uncheck the
"Disable Script Debugging" option. Then, the browser will offer to open a
debugging window when a JavaScript error occurs, and you can debug your
JavaScript just like any other code you write. You can set break points by
typing "debugger:" in a line by itself anywhere youwant the script to break.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
Neither a follower
nor a lender be.

"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:4E**********************************@microsof t.com...
Hi,
I have a Javascript function that loads a page with a progress bar for long process. The progress bar is a gif animation and for some reason it the
animation is stuck when the function is called so it looks like an image and not an animation. I have decided to put a wait function that will pause for 3 sec so that the animation will be loaded then the call the function for the long process.

This is the <SCRIPT> section

<SCRIPT language="javascript">

<body MS_POSITIONING="GridLayout"
onload="pause('<%Response.Write(redirectPage)%>',' <%Response.Write(Request.U
rl.Query)%>','<%Response.Write(secondsToWait)%>',' <%Response.Write(minutesTo
Wait)%>')"> var i = 0;

function redirectTo(targetPage, querystring, secondsForWaiting,
minutesForWaiting)
{
if (0 < targetPage.length)
{

location.replace(targetPage + querystring);

if (secondsForWaiting.valueOf() > 0)
{
msgLabel.innerText =
"This process can take up to "
+ secondsForWaiting + " seconds...";
timedIterations(secondsForWaiting);
}
else
{
if (minutesForWaiting.valueOf() > 0)
{
msgLabel.innerText =
"This process can take up to "
+ minutesForWaiting + " minutes...";
timedIterations(minutesForWaiting * 60);
}
}
}
else
{
msgLabel.innerText = "Page not found."
}
}

function timedIterations(secondsForIterating)
{
incrementalWidth = 800 / secondsForIterating;
if (i <= secondsForIterating + 10)
{
setTimeout(
"timedIterations(" + secondsForIterating + ");",
1000);
i++;
}
else
{

ProcessingLabel.innerText =
"The server is taking longer than "
+ "anticipated to process your request. "
+ "Thank you for your patience. "
+ "You can wait a few minutes longer for "
+ "the process to complete, or you can press "
+ "the back button and try again later...";
}
}

function pause(targetPage, querystring, secondsForWaiting,
minutesForWaiting)
{
setTimeout('redirectTo(targetPage, querystring, secondsForWaiting,
minutesForWaiting)',3*1000); <========== I am having the error here.
}


</SCRIPT>
this is the load event of my form

<body MS_POSITIONING="GridLayout"
onload="pause('<%Response.Write(redirectPage)%>',' <%Response.Write(Request.U
rl.Query)%>','<%Response.Write(secondsToWait)%>',' <%Response.Write(minutesTo
Wait)%>')">
On the load event I call the pause() FUNCTION which then pause for 3 secs so that the page with the animation is loaded then the pause() FUNCTION calls
the function the calls the page with the long process. The problem is when my page loads and call the pause function I get the runtime error:
"A runtime error has occured

Line 74

Error: Unterminated string constant"

Any ideas?

Thanks

Nov 19 '05 #2
i assume the <body> is not really in a script block. on the line:

setTimeout('redirectTo(targetPage, querystring, secondsForWaiting,
minutesForWaiting)',3*1000);

setTimeout wants a string to exec. any variables referenced must be global,
or they will not be defined. also this still will not be reliable, the gif
animation will probably stop when you execute the replace.

also try this syntax:

<body MS_POSITIONING="GridLayout"
onload="pause('<%=redirectPage%>',
'<%=Request.Url.Query%>',
'<%=secondsToWait)%>',
'<%=minutesToWait%>')">
-- bruce (sqlwork.com)


"Chris" <Ch***@discussions.microsoft.com> wrote in message
news:4E**********************************@microsof t.com...
| Hi,
| I have a Javascript function that loads a page with a progress bar for
long
| process. The progress bar is a gif animation and for some reason it the
| animation is stuck when the function is called so it looks like an image
and
| not an animation. I have decided to put a wait function that will pause
for 3
| sec so that the animation will be loaded then the call the function for
the
| long process.
|
| This is the <SCRIPT> section
|
| <SCRIPT language="javascript">
|
| <body MS_POSITIONING="GridLayout"
|
onload="pause('<%Response.Write(redirectPage)%>',' <%Response.Write(Request.U
rl.Query)%>','<%Response.Write(secondsToWait)%>',' <%Response.Write(minutesTo
Wait)%>')">
| var i = 0;
|
| function redirectTo(targetPage, querystring, secondsForWaiting,
| minutesForWaiting)
| {
| if (0 < targetPage.length)
| {
|
| location.replace(targetPage + querystring);
|
| if (secondsForWaiting.valueOf() > 0)
| {
| msgLabel.innerText =
| "This process can take up to "
| + secondsForWaiting + " seconds...";
| timedIterations(secondsForWaiting);
| }
| else
| {
| if (minutesForWaiting.valueOf() > 0)
| {
| msgLabel.innerText =
| "This process can take up to "
| + minutesForWaiting + " minutes...";
| timedIterations(minutesForWaiting * 60);
| }
| }
| }
| else
| {
| msgLabel.innerText = "Page not found."
| }
| }
|
| function timedIterations(secondsForIterating)
| {
| incrementalWidth = 800 / secondsForIterating;
| if (i <= secondsForIterating + 10)
| {
|
|
| setTimeout(
| "timedIterations(" + secondsForIterating + ");",
| 1000);
| i++;
| }
| else
| {
|
| ProcessingLabel.innerText =
| "The server is taking longer than "
| + "anticipated to process your request. "
| + "Thank you for your patience. "
| + "You can wait a few minutes longer for "
| + "the process to complete, or you can press "
| + "the back button and try again later...";
| }
| }
|
|
|
| function pause(targetPage, querystring, secondsForWaiting,
| minutesForWaiting)
| {
| setTimeout('redirectTo(targetPage, querystring, secondsForWaiting,
| minutesForWaiting)',3*1000); <========== I am having the error here.
| }
|
|
|
|
| </SCRIPT>
|
|
| this is the load event of my form
|
| <body MS_POSITIONING="GridLayout"
|
onload="pause('<%Response.Write(redirectPage)%>',' <%Response.Write(Request.U
rl.Query)%>','<%Response.Write(secondsToWait)%>',' <%Response.Write(minutesTo
Wait)%>')">
|
|
|
| On the load event I call the pause() FUNCTION which then pause for 3 secs
so
| that the page with the animation is loaded then the pause() FUNCTION calls
| the function the calls the page with the long process. The problem is when
my
| page loads and call the pause function I get the runtime error:
|
|
| "A runtime error has occured
|
| Line 74
|
| Error: Unterminated string constant"
|
| Any ideas?
|
| Thanks
|
Nov 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Edward King | last post by:
Hi! I am trying to achieve the following: I have a number of help pages (in the format help_nn.php where nn=helpid). I want to be able to open a particular help page by calling the function...
5
by: TrvlOrm | last post by:
HI There, I have been struggling with JavaScript code for days now, and this is my last resort! Please help... I am trying to create a JavaScript slide show with links for Next Slide,...
7
by: mike | last post by:
Hello, I am kind of new to this javascript stuff and I am constantly having problems trying to get my webpage validated. I have the following <script>printdate();</script> and when I validate it...
9
by: YZK | last post by:
Hello. I'm not a Web developer, just a user, and I think I may have somehow messed myself up majorly. I'm not quite sure how. Right now, javascript used by websites I go to either does not work at...
5
by: Craig Keightley | last post by:
Please help, i have attached my page which worksin IE but i cannnot get the drop down menu to fucntion in firefox. Any one have any ideas why? Many Thanks Craig ...
0
by: Erland | last post by:
Hello All, I am using AJAX library( AjaxEngine from http://www.mathertel.de/AJAXEngine/) and having problems and hope someone here can help me. I have some piece of javascript code that I...
1
by: JumpingOffPlace | last post by:
Hi, I'm hoping that the wealth of knowledge here can stop me from spinning my wheels on this syntax error for hours. :) Below is the code, and the error I am recieving.... Code: <!DOCTYPE...
36
by: aljamala | last post by:
Hi, I keep getting this warning on a page, but I do not know what the problem is...does anyone have an idea about what could be wrong? line 88 column 7 - Warning: missing </formbefore <td> it...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
7
by: gubbachchi | last post by:
Hi all, In my application I need to display the data fetched from mysql database after the user selects date from javascript calender. I have written the code in which after the user selects the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
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...

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.