单选按钮值检查操作是true还是false

时间:2012-01-24 10:57:48

标签: asp.net-mvc asp.net-mvc-3 razor asp.net-mvc-2-metadata

我是MVC的新手。我正在处理一个视图,其中我添加了两个单选按钮。

<label for="lDIV1">
    <input id="lDIV1" type="radio" name='rbtab' value='DIV1' onclick="javascript:custom()" />Create
    Email:</label>
<label for="lDIV2">
    <input id="lDIV2" type="radio" name='rbtab' checked="checked"  value='DIV2' onclick="javascript:defaul()" />Default
    Email:</label>
<div id='Content' style="display: block">

现在我想在Action {Http}中调用一个函数,即如果第一个单选按钮为true则调用radiobutton1()方法或者调用radiobutton2()方法 你能帮我解决一下如何申请条件吗。

1 个答案:

答案 0 :(得分:1)

我不确定你想做什么,因为你的问题不是那么清楚,但是当你用jquery检查复选框时,你可以做些什么

http://jsfiddle.net/HQXLm/1/

<input id="checkme" type="checkbox" /> click me to find out if im checked

$('#checkme').click(function(){
    if ($(this).is(':checked')){
         alert('I am checked, do something here');   
    }
});
相关问题