lingerUI二级联动
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="ahzytxSafeRep.View.safeReport.Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>安全报表上报</title>
<link href="http://www.cnblogs.com/lib/ligerUI/skins/Aqua/css/ligerui-all.css" rel="stylesheet" type="text/css" />
<link href="http://www.cnblogs.com/lib/ligerUI/skins/Silvery/css/ligerui-form.css" rel="stylesheet"
type="text/css" />
<script src="http://www.cnblogs.com/lib/jquery/jquery-1.3.2.min.js" type="text/javascript"></script>
<script src="http://www.cnblogs.com/lib/ligerUI/js/plugins/ligerResizable.js" type="text/javascript"></script>
<script src="http://www.cnblogs.com/lib/ligerUI/js/ligerui.min.js" type="text/javascript"></script>
<script src="http://www.cnblogs.com/lib/jquery-validation/jquery.validate.min.js" type="text/javascript"></script>
<script src="http://www.cnblogs.com/lib/ligerUI/js/plugins/ligerCheckBox.js" type="text/javascript"></script>
<script src="http://www.cnblogs.com/lib/ligerUI/js/plugins/ligerComboBox.js" type="text/javascript"></script>
<script src="http://www.cnblogs.com/lib/ligerUI/js/plugins/ligerDateEditor.js" type="text/javascript"></script>
<script src="http://www.cnblogs.com/lib/ligerUI/js/plugins/ligerLayout.js" type="text/javascript"></script>
<script src="http://www.cnblogs.com/lib/ligerUI/js/plugins/ligerForm.js" type="text/javascript"></script>
<script src="http://www.cnblogs.com/lib/json2.js" type="text/javascript"></script>
<script type="text/javascript">
var cmb1, cmb2;
$(function() {
$("form").ligerForm();
$("#txtDate").ligerDateEditor();
cmb1 = $("#cmb1").ligerComboBox({ data: null, textField: "dept_name", valueField: "dept_code", isMultiSelect: false, onSelected: function(newvalue) { setdata(cmb2, "../Ajax/ajaxSelDept.ashx?act=selDeptNew&deptCode=" + newvalue); } });
cmb2 = $("#cmb2").ligerComboBox({ data: null, textField: "dept_name", valueField: "dept_code", isMultiSelect: false });
setdata(cmb1, "../Ajax/ajaxSelDept.ashx?act=selDept"); //页面加载时,先加载cmb1的值
});
function setdata(obj, url) {
$.getJSON(url + "&r=" + Math.round(Math.random() * 1000000).toString(),
function(json) {
obj.setData(json); //把json塞到下拉框里面去
// $("#txtjson").val(JSON2.stringify(json));
}
);
}
function getid() {
$.ligerDialog.success($("#cmb1_val").val() + "_" + $("#cmb2_val").val() + "<br/><br/>" +
$("#cmb1").val() + "_" + $("#cmb2").val()
); //下拉框取后台id的用法,每个ligerui的下拉框会创建一个id_val的hidden用来存放id
}
function f_submit() {
var form = document.forms[0];
var selCity =$("#test1").val();;
var selTown = $("#test2").val();;
var txtDate = document.getElementById("txtDate").value;
if (selCity == "") {
alert("城市不能为空");
return false;
}
if (selTown== "") {
alert("县公司不能为空");
return false;
}
if (txtDate == "") {
alert("时间不能为空");
return false;
}
else {
form.submit();
}
}
</script>
<style type="text/css">
body{ padding:5px; margin:0; padding-bottom:15px;}
#layout1{ width:100%;margin:0; padding:0; }
.l-page-top{ height:50px; background:#f8f8f8; margin-bottom:3px;}
h4{ margin:20px;}
.l-table-edit {}
.l-table-edit-td{ padding:4px;}
.l-button-submit,.l-button-reset{width:80px; float:left; margin-left:10px; padding-bottom:2px;}
.l-verify-tip{ left:230px; top:120px;}
</style>
</head>
<body style="padding:6px; ">
<div class="l-page-top">
<form name="form1" method="post" id="form1" action="addSafeReport.aspx?flag=1" target="home">
<table cellpadding="1" cellspacing="1">
<tr >
<td>选择地市</td>
<td width="30px">
<input type="text" id="cmb1"/>
</td>
<td >选择县公司</td>
<td width="30px">
<input type="text" id="cmb2"/>
</td>
<td align="right" >归属日期</td>
<td class="l-table-edit-td">
<input type="text" id="txtDate" width="30px" />
</td>
<td colspan="1" align="right">
<input id="btnOK" type="button" value="添加" onclick="f_submit()" class="l-button l-button-submit"/>
</td>
<td colspan="1" align="left">
<input type="reset" value="重置" class="l-button l-button-reset"/>
</td>
</tr>
</table>
</form>
</div>
<div id="layout1">
<div position="center" title="标题" >
<iframe frameborder="0" name="home" src="addSafeReport.aspx" width="100%" height="380px"></iframe>
</div>
</div>
<div style="display:none;">
</div>
</body>
</html>