﻿$(function() {
    $.ajax({
        type: "GET",
        url: "/ashx/Vote.ashx?width=254",
        success: function(msg) {
            $("#divVote").append(msg);
        }
    });
});
//将选择的ID加到隐藏域
function SetSelectValue(txtHidden, id) {
    var blnChecked = event.srcElement.checked;
    var idValue = document.getElementById(txtHidden).value;
    document.getElementById(txtHidden).value = "," + id + ",";
}

function SetSelectValueMultiple(txtHidden, id) {
    var blnChecked = event.srcElement.checked;
    var idValue = document.getElementById(txtHidden).value;
    if (blnChecked) {
        if (idValue.indexOf("," + id + ",") == -1) {
            if (idValue == "") {
                idValue = "," + id + ",";
            }
            else {
                idValue += id + ",";
            }
        }
    }
    document.getElementById(txtHidden).value = idValue;
}
function radioSelect(num) {
    var hidSelectIDs = document.getElementById('hidSelect');
    hidSelectIDs.value = "," + num + ",";
}
function checkSelected(controlname, id) {
    var ids = document.getElementById(controlname).value;
    if (ids == "") {
        alert("请选择投票项！")
        return false;
    }
    $.ajax({
        type: "GET",
        url: "/ashx/Vote.ashx?Action=update&id=" + ids + "&voteid=" + id,
        success: function(msg) {
            if (msg == "ok")
                alert("投票成功！");
            else if (msg == "re") {
                alert("请勿重复投票");
            }
        }
    });
    return true;
}
