passing a changed variable value to javascript

May 5, 2007 at 12:56 AM
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.
May 25, 2007 at 11:42 PM
This forum is for CodePlex web site issues and discussion only. Please re-post your question to the appropriate project's forum.

Thanks!