<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>地址列表</title> <link rel="stylesheet" type="text/css" media="screen" href="../css/cssgame/smoothness/jquery-ui-1.7.2.custom.css" /> <link rel="stylesheet" type="text/css" media="screen" href="../css/cssgame/ui.jqgrid.css" /> <style> html,body { margin: 0; padding: 0; font-size: 80%; } </style> <script type="text/javascript" src="../js/jsgame/jquery.min.js"></script> <script src="/js/myweb/i18n/grid.locale-cn.js" type="text/javascript"></script> <script type="text/javascript" src="../js/jsgame/jquery.jqGrid.min.js"></script> <script type="text/javascript" src="../js/jsgame/ui.core.js"></script> <script type="text/javascript" src="../js/jsgame/ui.draggable.js"></script> <script type="text/javascript" src="../js/jsgame/ui.resizable.js"></script> <script type="text/javascript" src="../js/jsgame/ui.dialog.js"></script> <script type="text/javascript" src="../js/jsgame/effects.core.js"></script> <script type="text/javascript" src="../js/jsgame/effects.highlight.js"></script> <script type="text/javascript" src="../js/jsgame/jquery.bgiframe.js"></script> <script type="text/javascript" src="../js/jsgame/jquery.form.js"></script> <script type="text/javascript"> function postform(){ var options = { url:"g_wap_chaddr_crud.jsp?type=add", type:"post", success: function(msg){ //alert(msg); alert(msg.substring(2,msg.length).replace("error","添加失败").replace("success","添加成功").replace("exist","该ID已经存在")); $("#myweb_list").trigger("reloadGrid"); } }; $('#myweb_form').ajaxSubmit(options); } // 删除 function del(){ $.ajax({ type: "POST", url:"g_wap_chaddr_crud.jsp?type=del&id="+$("#ch_id_del").attr("value"), success: function(msg){ //alert(msg);alert(msg.length); alert(msg.substring(2,msg.length).replace("error","删除失败").replace("success","删除成功")); $("#myweb_list").trigger("reloadGrid"); /* if(msg.length==9){ alert("删除成功"); $("#myweb_list").trigger("reloadGrid"); }else if(msg.length==7){ alert("删除失败"); $("#myweb_list").trigger("reloadGrid"); } */ } }); } // 修改 function update_(){ $.ajax({ type: "POST", url:"g_wap_chaddr_crud.jsp?type=update&id="+$("#channel_up_id").attr("value")+"&channel_addr_up="+$("#channel_addr_up").attr("value")+"&channel_name_up="+$("#channel_name_up").attr("value"), success: function(msg){ //alert(msg); alert(msg.substring(2,msg.length).replace("error","修改失败").replace("success","修改成功")); $("#myweb_list").trigger("reloadGrid"); } }); } // 修改 function update(){ var options = { url:"g_wap_chaddr_crud.jsp?type=update", type:"post", success: function(msg){ alert(msg.substring(2,msg.length).replace("error","修改失败").replace("success","修改成功")); $("#myweb_list").trigger("reloadGrid"); } }; $('#myweb_form_up').ajaxSubmit(options); } // 添加 function add(){ $.ajax({ type: "POST", url:"g_wap_chaddr_crud.jsp?type=add&channel_name="+$("#channel_name").attr("value"), success: function(msg){ //alert(msg); alert(msg.substring(2,msg.length).replace("error","添加失败").replace("success","添加成功").replace("exist","该机型已经存在")); $("#myweb_list").trigger("reloadGrid"); } }); } // 批量添加 function add_batch(){ $.ajax({ type: "POST", url:"g_wap_chaddr_crud.jsp?type=add_batch&channel_batch="+$("#channel_batch").attr("value"), success: function(msg){ //alert(msg); alert(msg.substring(2,msg.length).replace("error","添加失败").replace("success","添加成功").replace("exist","该机型已经存在")); $("#myweb_list").trigger("reloadGrid"); } }); } jQuery(document).ready(function(){ jQuery("#myweb_list").jqGrid({ url:'g_wap_chaddr_data.jsp', datatype: 'xml', mtype: 'GET', colNames:['序号','ID','名称','地址'], colModel :[ {name:'id',align:"center",width:"15%",search:false}, {name:'channel_id',align:"center",width:"20%",search:true}, {name:'channel_name',align:"center",width:"25%",search:true}, {name:'channel_addr',align:"center",width:"50%",search:false} ], xmlReader: { root: "rows", row: "row", page: "rows>page", total: "rows>total", records : "rows>records", repeatitems: true, cell: "cell", id: "[id]" }, pager: '#myweb_pager', rowNum:25, rowList:[25,50,100], viewrecords: true, height: "100%", autowidth:true, forceFit:true, multiselect: true, gridview : true, caption: '地址列表' }); jQuery("#myweb_list").navGrid('#myweb_pager',{ edit:false,add:false,del:false,search:false,refreshtext:"刷新" } ); jQuery("#myweb_list").navButtonAdd('#myweb_pager',{ caption:"修改",buttonicon:"ui-icon-pencil",title:"修改", onClickButton: function(){ var gr = jQuery("#myweb_list").jqGrid('getGridParam','selarrrow'); var len = gr.length; if(len==0){ alert("请选择要修改的纪录"); }else if(len>1){ alert("修改时只能选中一条记录"); }else{ var rowid=gr[0]; //var contents = $("#myweb_list").getCell(rowid, "invdate")+$("#myweb_list").getCell(rowid, "amount"); $("#channel_name_up").attr("value",$("#myweb_list").getCell(rowid, "channel_name")); $("#channel_addr_up").attr("value",$("#myweb_list").getCell(rowid, "channel_addr")); $("#channel_id_up").attr("value",$("#myweb_list").getCell(rowid, "channel_id")).attr("readonly","true"); $("#channel_up_id").attr("value",rowid); $('#shsp_dialog_up').dialog('option', 'title', '修改'); $('#shsp_dialog_up').dialog('open'); } }, position:"last" }); jQuery("#myweb_list").navButtonAdd('#myweb_pager',{ caption:"删除",buttonicon:"ui-icon-trash",title:"删除", onClickButton: function(){ var gr = jQuery("#myweb_list").jqGrid('getGridParam','selarrrow'); var len = gr.length; if(len==0){ alert("请选择要删除的纪录"); }else{ var rowid=gr[0]; var contents = $("#myweb_list").getCell(rowid, "invdate"); $("#ch_id_del").attr("value",gr); $("#ch_id_del").attr("readonly","true"); $('#shsp_dialog_del').dialog('option', 'title', '删除'); $('#shsp_dialog_del').dialog('open'); }}, position:"last" }); /* jQuery("#myweb_list").navButtonAdd('#myweb_pager',{ caption:"明细",buttonicon:"ui-icon-pencil",title:"明细", onClickButton: function(){ var gr = jQuery("#myweb_list").jqGrid('getGridParam','selarrrow'); var len = gr.length; if(len==0){ alert("请选择要察看明细的纪录"); }else if(len>1){ alert("察看明细时只能选中一条记录"); }else{ var rowid=gr[0]; //self.location='g_channel_gart.jsp?ch_id='+$("#myweb_list").getCell(rowid, "ch_id")+'&id='+rowid+'&game_type_id='+$("#myweb_list").getCell(rowid, "game_type_id"); self.location='ser_ua_list_gart.jsp?id='+rowid; } }, position:"last" }); jQuery("#myweb_list").navButtonAdd('#myweb_pager',{ caption:"查询",buttonicon:"ui-icon-document",title:"查询", onClickButton: function(){ jQuery("#myweb_list").jqGrid('searchGrid', {sopt:['eq']} ); }, position:"last" }); jQuery("#myweb_list").navButtonAdd('#myweb_pager',{ caption:"返回",buttonicon:"ui-icon-document",title:"返回上级", onClickButton: function(){ self.location='g_channel_list.jsp'; }, position:"last" }); */ // 添加 jQuery("#myweb_list").navButtonAdd('#myweb_pager',{ caption:"添加",buttonicon:"ui-icon-check",title:"添加", onClickButton: function(){ $('#shsp_dialog').dialog('open'); }, position:"last" }); /* 批量添加 jQuery("#myweb_list").navButtonAdd('#myweb_pager',{ caption:"批量添加",buttonicon:"ui-icon-check",title:"添加", onClickButton: function(){ $('#shsp_dialog_batch').dialog('open'); }, position:"last" }); */ }); </script> <script type="text/javascript"> $(function() { // 删除 $("#shsp_dialog_del").dialog({ bgiframe: true, autoOpen: false, modal: true, buttons: { '提交': function() { var bValid = true; if (bValid) { del(); $(this).dialog('close'); } }, '取消': function() { $(this).dialog('close'); $("#myweb_list").trigger("reloadGrid"); } } }); // 修改 $("#shsp_dialog_up").dialog({ bgiframe: true, autoOpen: false, modal: true, buttons: { '确定修改': function() { var bValid = true; var ser_ = $("#channel_addr_up").attr("value"); if(ser_!=""){ update(); }else{ alert("修改的地址不能为空"); } $(this).dialog('close'); }, '取消': function() { $(this).dialog('close'); $("#myweb_list").trigger("reloadGrid"); } } }); // 新增 $("#shsp_dialog").dialog({ bgiframe: true, autoOpen: false, modal: true, buttons: { '提交': function() { var bValid = true; var ch_id = $("#channel_id").attr("value"); var ch_addr = $("#channel_addr").attr("value"); if(ch_id==""){ alert("渠道ID不能为空"); }else if(ch_addr==""){ alert("渠道地址不能为空"); }else{ //add(); postform(); } $(this).dialog('close'); }, '取消': function() { $(this).dialog('close'); $("#myweb_list").trigger("reloadGrid"); } } }); /* 批量新增 $("#shsp_dialog_batch").dialog({ bgiframe: true, autoOpen: false, modal: true, buttons: { '提交': function() { var bValid = true; var ser_ = $("#channel_batch").attr("value"); //alert(ser_); //alert($("#upload_text").attr("value")); if(ser_!=""){ add_batch(); $(this).dialog('close'); }else{ alert("新增型号不能为空"); $(this).dialog('close'); } }, '取消': function() { $(this).dialog('close'); $("#myweb_list").trigger("reloadGrid"); } } }); */ }); </script> </head> <body> <table id="myweb_list"></table> <div id="myweb_pager"></div> <div id="shsp_dialog_del" title="删除"> 删除此条数据:<input type="text" name="ch_id" id="ch_id_del" readonly value=""/> </div> <div id="shsp_dialog" title="添加"> <form id="myweb_form" name="myweb_form" enctype="multipart/form-data" action="g_wap_chaddr_crud.jsp" method="post"> 名称:<br/><input type="text" name="channel_name" id="channel_name" value="" style ="width:250px;cursor:hand"/><br/> ID:<br/><input type="text" name="channel_id" id="channel_id" value="" style ="width:250px;cursor:hand"/><br/> 地址:<br/><input type="text" name="channel_addr" id="channel_addr" value="" style ="width:250px;cursor:hand"/> </form> </div> <div id="shsp_dialog_up" title="修改"> <form id="myweb_form_up" name="myweb_form_up" enctype="multipart/form-data" action="g_wap_chaddr_crud.jsp" method="post"> 名称:<br/><input type="text" name="channel_name_up" id="channel_name_up" value="" style ="width:280px;cursor:hand"/><br/> ID:<br/><input type="text" name="channel_id_up" id="channel_id_up" value="" style ="width:280px;cursor:hand"/><br/> 地址:<br/><input type="text" name="channel_addr_up" id="channel_addr_up" value="" style ="width:280px;cursor:hand"/> <input type="hidden" name="id" id="channel_up_id" value=""/> </form> </div> <%-- <div id="shsp_dialog_batch" title="批量添加"> 新增:(用逗号隔开) <textarea cols="40" id="channel_batch" name="channel_batch" rows="10"></textarea> <input type="text" name="channel_batch" id="channel_batch" value="" style ="width:200px;cursor:hand"/><br/> --%> </div> </body> </html>