我该怎么办? [英] how can I do like this?

查看:127
本文介绍了我该怎么办?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

访问此处 http://cv.nku.edu.tr/adekogrenci.php [ ^ ]

如果您单击单选按钮列表项的计数器计数

留在屏幕上我该怎么做?

解决方案

对于您的单选按钮,将其onclick属性设置为 countUp() .然后使用javascript函数更新计数器并在元素中显示其值.像这样:

<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>


< script type = " >
 var 计数器=  0 ;

函数 countUp(){
    计数器++;
    文档 .getElementById(" ) .innerHTML =计数器;
}
</script> 


在html中的每个input type="radio" ...对象中,您将都有一个onclick处理程序,该处理程序将命中类似于Zetta的javascript方法如上所示.
在该onclick处理程序中,您将必须遍历DOM对象并计算已检查的单选项目的数量,然后将结果值设置为适当的标签以显示该值

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 ?

解决方案

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>


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

function countUp() {
    counter++;
    document.getElementById("result").innerHTML = counter;
}
</script>


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


这篇关于我该怎么办?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆