Click here to Skip to main content
15,908,175 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
visit here http://cv.nku.edu.tr/adekogrenci.php[^]

if you clicked radiobuttonlist itemss counter count

left on the screen how can ı do like that ?
Posted
Updated 20-Feb-12 4:46am
v2
Comments
E.F. Nijboer 20-Feb-12 9:41am    
You can just check out the source of that page to see how its done.

for your radio buttons, set their onclick property to countUp(). Then use a javascript function to update a counter and show its value in an element. like this :

<input type="radio" name="a" value="a" checked=""  önclick="CountUp()">a</input>
<input type="radio" name="b" value="b"  önclick="CountUp()">b</input>

<div id="result">0</div>

JavaScript
<script type="text/javascript">
var counter = 0;

function countUp() {
    counter++;
    document.getElementById("result").innerHTML = counter;
}
</script>
 
Share this answer
 
v4
Comments
Member-2338430 20-Feb-12 9:48am    
but I use radiobuttonlist item I didnt use radiobutton

radiobuttonlist not has onclick even

I have radiobuttonlist and radiobuttonlist items
The Zetta 20-Feb-12 9:52am    
there is no radiobuttonlist element in html. every radiobuttonlist generates html code like above. if you are doing it with ASP.NET, like c#, you need to set each generated radiobutton's onclick attribute. something like this :

foreach(ListItem RadioButton in RadioButtons){
RadioButton.Attributes.Add("onclick", "countUp();");
}
In each of the input type="radio" ... objects that are in your html you will have an onclick handler that will hit a javascript method similar to what The Zetta has shown above.
In that onclick handler you will have to loop through the DOM objects and count the number of radio items that are checked and then set the resulting value to the appropriate label that is to show the value
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900