passsing a changed variable value in javascript

G

Guest

Hello Everyone,

I want to display a progress bar on my web page. I have this code for
progress bar in javascript in my web page.
I have a button on the web page, if someone clicks that button then that
progress bar should start and
it should stop when the variable that I am passing in the javascript becomes
greater than 1.
That variable value starts with zero and it increases after making a call to
another function called func.
I was wondering how can I recognize the changed value in the javascript
function. Right now it recognizes 0
in the progress function, but I don't know how will the javascript function
will recognize the changed variable value. The variable that I am pasing to
Javascript is arStop. Below is the code in my CS page. That global varaible
in incremented in stop_click

btnStopServices.Attributes.Add("onclick","progress('" + arStop.Count + "');");

and my javascript is

<script language="javascript">

var i = 1;
var timerID = 0;
//timerID = setTimeout("progress()",1000); // 1 second interval. this can
be made dynamic
var scell = '';
var sbase = '';
sbase = document.getElementById("cell1").innerHTML;

function progress(count)
{

var tend = "</tr></table>";
var tstrt = "<table><tr>";
scell = scell + "<td style='width:10;height:10' bgcolor=red>";

document.getElementById("cell1").innerHTML = sbase + tstrt + scell + tend;


if( i < 50) // total 50 cell will be created with red color.
{
i = i + 1;

timerID = setTimeout("progress()",1000); // recursively calling
}
else
{
if(timerID)
{
document.getElementById("cell1").innerHTML =
document.getElementById("cell1").innerHTML + "</tr></table>";
clearTimeout(timerID);

}
}

}
</script>

ArrayList arStop= new ArrayList(); // global varaible
private void btnStop_Click(object sender, System.EventArgs e)
{
arStop = func();


}

private arrayList func()
{


}

Any help will be appreciated.

Thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top