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

passsing a changed variable value in javascript

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 5 '07 #1
0 1238

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

Similar topics

7
by: Donna Hawkins | last post by:
I want to use javascript to redirect to a URL which has been passed as a variable (in php). I have searched but cannot find any solution. I think this code is a basic redirect: <script...
1
by: zdhiu | last post by:
Hi javascript gurus, I have a simple html file (simple.html) with javascript. In html page there is sentence from variable defined in .js file (myFirst.js). Once I reload another .js file...
6
by: Neil | last post by:
Hi, I have an aspx page with a number of web controls on it and one of these is a cancel button. I want to check the page to see if the user has changed any of the controls, i..e typed some text...
11
by: John | last post by:
Hi I have a main form which contains a panel which contains a child form. So the hierarchy is as follows; frmMain->MyPanel-> frmChild I have a toolbar on the main form. When a user presses a...
4
by: Carlos Gomez | last post by:
In VB6 the default for passing variables was ByRef. It was faster and used less memory. Why did MS changed that? Are there any advantages using ByVal over ByRef? (other than ByVal impeding you from...
23
by: Russ Chinoy | last post by:
Hi, This may be a totally newbie question, but I'm stumped. If I have a function such as: function DoSomething(strVarName) { ..... }
4
by: Server Control | last post by:
Hi, I have a datagrid(within a user control) that has label controls. I have added hidden fields in the datagrid alongwitht the label control. I do some client side editing with javascript and...
19
by: Taras_96 | last post by:
Hi everyone, How do you detect that a form element has been changed? This thread: ...
1
pbmods
by: pbmods | last post by:
VARIABLE SCOPE IN JAVASCRIPT LEVEL: BEGINNER/INTERMEDIATE (INTERMEDIATE STUFF IN ) PREREQS: VARIABLES First off, what the heck is 'scope' (the kind that doesn't help kill the germs that cause...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.