Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Gridview中复选框后面的Javascript函数_Javascript_Jquery_Asp.net - Fatal编程技术网

Gridview中复选框后面的Javascript函数

Gridview中复选框后面的Javascript函数,javascript,jquery,asp.net,Javascript,Jquery,Asp.net,我有一个Javascript函数,当复选框被选中时,即将“Chk”设置为true,但当复选框未被选中时,即也将“Chk”设置为true,该函数可以正常工作。然后,该函数将两个参数传递给第二个页面,该页面运行存储的过程(将值设置为true或false)。 这是我的密码: <script src="Scripts/jquery-1.4.1.js" type="text/javascript" language="javascript"></script> <sc

我有一个Javascript函数,当复选框被选中时,即将“Chk”设置为true,但当复选框未被选中时,即也将“Chk”设置为true,该函数可以正常工作。然后,该函数将两个参数传递给第二个页面,该页面运行存储的过程(将值设置为true或false)。 这是我的密码:

    <script src="Scripts/jquery-1.4.1.js" type="text/javascript" language="javascript"></script>
<script type="text/javascript">
    function myfunction(invId, Chk) {
    var chkboxValue = ($("#iSelect").is(":checked") ? false : true);
    $.ajax({
        type: "GET",
        url: "upDateMe.aspx?param1=" + invId +"&param2=" + chkboxValue,
        data: "",
        contentType: "text/html",
        dataType: "text"
    });
}

函数myfunction(因维德,Chk){
var chkboxValue=($(“#iSelect”)。是否(“:选中”)?false:true);
$.ajax({
键入:“获取”,
url:“upDateMe.aspx?param1=“+invId+”¶m2=“+chkboxValue,
数据:“,
contentType:“文本/html”,
数据类型:“文本”
});
}

您可以使用此选项获取复选框状态值

var chkboxValue = ($("#iSelect").prop('checked'));
这将获取它是真是假 您的函数应该是这样的

function myfunction(invId, Chk) {
    var chkboxValue = ($("#iSelect").prop('checked'));
    $.ajax({
        type: "GET",
        url: "upDateMe.aspx?param1=" + invId +"&param2=" + chkboxValue,
        data: "",
        contentType: "text/html",
        dataType: "text"
    });
}

是您想要的小提琴:

复选框未选中时会发生什么?不工作是不够的信息:)如何调用函数?问题是…?谢谢,但我得到-Microsoft JScript运行时错误:对象不支持属性或方法“prop”,您应该使用jquery 1.6或更高版本