复选框回显、全选、非全选、cookie处理数据、json数组对象转换处理学习笔记参考的页面

 

<%@include file="/common/head.jsp"%>
<%@ page contentType="text/html; charset=UTF-8"%>
<script type="text/javascript">

function send() {
    var receivers = new Array();
    receivers = $("#usercodes").val().split(",");
    var paramforms = new Array();
    var paramSize = receivers.length;
    if ($("#usernames").val() == null || $("#usernames").val() == "") {
        $.messager.alert('提示信息', "请选择需发送人!", 'warning');
        return false;
    } else {
        for (var i = 0; i < paramSize; i++) {
            if ($(":checkbox:checked").length == 0) {
                $.messager.alert('提示信息', '请选择需要送阅的项目!', 'warning');
                return false;
            } else {
                $(":checkbox:checked").each(
                function() {
                    var strs = new Array();
                    strs = $(this).val().split(",");
                    var projid = strs[0];
                    var compserialid = strs[1];
                    var projcode = strs[2];
                    var projname = strs[3];
                    var busstype = strs[4];
                    var assuremoney = strs[5];
                    var customername = strs[6];

                    paramforms.push({
                        receiver: receivers[i],
                        infourl: '?projid=' + projid + '&compserialid=' + compserialid,
                        infodesc : projcode+'_'+customername+'_'+assuremoney+"万元"
                    });
                });
            }
        }
    }

    var url = '<s:url value="/common/deliverInfoMgr!addDeliverInfo.ajax"/>';
    var params = {
        uiDeliverInfo: JSON.stringify(paramforms)
    }
    $.post(
    url, //服务器要接受的url
    params, //传递的参数        
    function(returnData) {
        alert("成功发送给:" + $("#usernames").val());
        //$.messager.alert('提示', "发送成功");                     
    },
    'json' //数据传递的类型  json
    );
}


function showSendMsg() {
    if ($("#sendMsg").css("display") == "none") {
        $("#sendMsg").css("display", "inline");
    } else {
        $("#sendMsg").css("display", "none");
    }
}
    </script>

    <table class="clear" cellSpacing=0 cellPadding=0 width="100%"
        border=0>
        <tr class="td_views_left">
            <td colspan="4">
                <input type="button" class="buttoncls" value=" 送  阅 "
                    onClick="showSendMsg()">
            </td>
        </tr>
        <tr class="clear" id="sendMsg" style="display: none">
            <td>
                <input type="button"
                    onclick="openModalWindow('人员选择','<s:url value="/common/queryEmps.action"/>?limit=5&empstatus=001&isAddOp=yes',600,500);"
                    class="buttoncls" value=" 选  择 " />
                <input type="button" value=" 发  送 " id="send" onclick="send()" class="buttoncls" />
                <input type="text" size="60" id="usernames" readonly="readonly" />
                <input type="hidden" id="usercodes" />
                <input type="hidden" id="userids" />
            </td>
        </tr>
    </table>

 

posted @ 2018-09-13 15:41  xh_Blog  阅读(313)  评论(0编辑  收藏  举报