凌寒飘香

____成风破浪会有时,直把云帆济沧海!

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: :: 管理 ::

value1 = $("#<%=hid_Value.ClientID%>").val();
            value1 = value1.substring(0, (value1.length - 1));
            eval("var txtValue = {" + value1 + "}");

            $("#<%=chbDrugList.ClientID%> input[type=checkbox]").each(function () {
                var chbId = this.id;
                if (this.checked) {
                    var txtId = $("#" + chbId).val();
                    $.each(txtValue, function (i, n) {
                        if (i == "txtDrug" + txtId) {
                            var volume = n;
                            var str = "&nbsp;&nbsp;<input name='' id='txtDrug" + txtId + "' onclick='javascript:return getvlaue(this)'  type='text' value='" + volume + "'/>";
                            var lblstr = "&nbsp;<label id='lbl" + chbId + "'>mg</label>";
                            $("#" + chbId).parent().append(str).append(lblstr);
                        }
                    });

                }
            });

 

 function getvlaue(obj) {
            $("#" + obj.id).focusout(function () {
                var oldValue = $("#<%=hid_Value.ClientID %>").val();
                var txtValue = oldValue + obj.id + ":" + $("#" + obj.id).val() + ",";
                $("#<%=hid_Value.ClientID %>").val(txtValue);
            });
        }

posted on 2012-08-21 16:53  凌寒飘香  阅读(159)  评论(0编辑  收藏  举报