开发者

checkbox checked or unchecked

开发者 https://www.devze.com 2023-04-09 12:11 出处:网络
functio开发者_JAVA技巧n Check_Clickd_li(objRef) { var btn1 = $find(\"<%= RadButton1.ClientID %>\");
functio开发者_JAVA技巧n Check_Clickd_li(objRef) {
    var btn1 = $find("<%= RadButton1.ClientID %>");
    var btn2 = $find("<%= RadButton2.ClientID %>");                
    if (objRef.checked = true) {
        btn1.set_enabled(true);
        btn2.set_enabled(true);
        alert("Enable");
    }
    else if (objRef.checked = false) {
        btn1.set_enabled(false);
        btn2.set_enabled(false);
        alert("Disable");
    }
}

What is the problem in this code? It always says "Enable".


You're doing an assignment. Use == for a comparison, or just:

if (objRef.checked) {
    // ...
}


You need to use == for comparison (or just test if(objRef.checked)).

Right now you set the value to true...

0

精彩评论

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