开发者

ajax sliders and Javascript

Rewriten to make things simple and give me the understanding I need...

I want to know how to update the Ajax Control Toolkits Maximum value and how to get the current value of one of the sliders. this all should be done on the client-side.

The Idea is like this:

int Used      = 0
int max       = 325
int Remainder = max - Used

slider1.maximum = Remainder
slider2.maximum = Remainder
slider3.maximum = Remainder

slider1.value = 0
slider2.value = 0
slider3.value = 0

slider1.Setvalue = 150
   Used = 150
   Remainder = 175
   slider1.maximum = Remainder   + slider1.value 
            Becoming 175         + 150
   Slider2.maximum = Remainder   + slider2.value
            Becoming 开发者_高级运维175         + 0
   Slider3.maximum = Remainder   + slider3.value
            Becoming 175         + 0

slider2.Setvalue = 50
   Used = 200
   Remainder = 125
   slider1.maximum = Remainder   + slider1.value 
            Becoming 125         + 150
   Slider2.maximum = Remainder   + slider2.value
            Becoming 125         + 50
   Slider3.maximum = Remainder   + slider3.value
            Becoming 125         + 0

slider3.Setvalue = 125
   Used = 325
   Remainder = 0
   slider1.maximum = Remainder   + slider1.value 
            Becoming 0           + 150
   Slider2.maximum = Remainder   + slider2.value
            Becoming 0           + 50
   Slider3.maximum = Remainder   + slider3.value
            Becoming 0           + 125         

Slider1.Setvalue = 125
   Used = 300
   Remainder = 25
   slider1.maximum = Remainder   + slider1.value 
            Becoming 25          + 125
   Slider2.maximum = Remainder   + slider2.value
            Becoming 25          + 50
   Slider3.maximum = Remainder   + slider3.value
            Becoming 25          + 125  

I don't think this can become any clearer, so please give me some feed back. much appreciated!

And once the user is happy with the setup it should be send back to the server with a button..


I know this is an old question, but since no one answered and this is the first page I looked at (googling this same question), I thought I'd drop the answer I found here. Maybe it'll shorten someone else's search.

Let's assume that the textbox you're extending is named Slider1. You set the value of the slider, and the Maximum value using $find(). Ie:

$find("Slider1").set_Maximum(100);
$find("Slider1").set_Value(500);

You GET the value of the slider from the bound text box, the same way you would from any other element. So:

var sliderValue = document.getElementById('<%=Slider1_bound.ClientID%>').value;
  • Pete
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜