if (op == "edit") {
var pid = -1;
$("#btnSave").val(" 修改 ");
$.ajax({
type: "post",
url: "../ajax/ModuleManager.ashx",
dataType: 'json',
data: { op: "showOne", mid: modeId },
success: function(res) {
$(res["ShowOne"]).each(function(i, node) {
$("#txtName").val(node.ModuleName);
$("#txtUrl").val(node.ModuleUrl);
$("#txtDes").val(node.ModuleDes);
level = node.ModuleType;
pid = node.ModuleParentID;
showSr(level, pid);
}); }
}); }
function showSr(l, p) {
if (l == 1) {
$("#dfirst").show();
$("#dsecond").hide();
$("#dthird").hide();
$("#first").attr("checked", "true");
}
else if (l == 2) {
$("#dfirst").hide();
$("#dsecond").show();
$("#dthird").hide();
$("#second").attr("checked", "true");
GetFistNode();
showSf(p); } else if (l == 3) {
$("#dfirst").hide();
$("#dsecond").show();
$("#dthird").show();
$("#third").attr("checked", "true");
GetFistNode();
GetSecondNode();
showSf(p);
// showSs();
} function showSf(p) {
$.ajax({
type: "post",
url: "../ajax/ModuleManager.ashx",
dataType: 'json',
data: { op: "showOne", mid: p },
success: function(res) {
$(res["ShowOne"]).each(function(i, node) {
$("#sfirst").val(node.ModuleName);
alert(node.ModuleName);
});
}
});
}
<td>
<input type="radio" id="first" name="1" />第一级模块
<input type="radio" id="second" name="1" />第二级模块
<input type="radio" id="third" name="1" />第三级模块
解决方案 »
- asp.net输出图象文件二进制数制
- 很奇怪的问题:关于传参!!!!!
- 在 ConnectionString 中未指定 OLE DB 提供程序。示例为:“Provider=SQLOLEDB;”。
- mht附件下载的问题,十分诡异
- 缓存失效问题
- 简单错误,搞定送分
- 动态生成datagrid怎么在页面显示呀?
- Oracle9i系列,那个版本可以用Ado.net连?
- DataGrid1_SelectedIndexChanged怎么触发不了呢?奇怪
- Please help on how to get client installed printer in a web!! Thanks a lot.
- 急!!!关于CalendarExtender控件!!!!!!!!!!!!!!!
- 求excel导入数据库实例!
第一级目录无父节点</div>
<div id="dsecond">
<select id="sfirst">
</select>
</div>
<div id="dthird">
<select id="sSecond">
</select>
</div>
</td>
<td id="wslevel" align="left">
</td>
<select id="firstdName">
<option value="1">sss</option >
<option value="2">aaa</option >
<option value="3">bbb</option >
</select>
如果传过来的是 2 如何使用JQ让2 选中?
我要它的值选中某个 用JQ实现
for(var i=0;i<$("firstdName").options.length;i++)
{
if($("firstdName").options[i].value=="2")
{
$("firstdName").options[i.selected="selected";//Jquery我不会,不知道$("firstdName")这样写错没
break;
}
}
好像没有直接能根据Value值让下拉列表直接选中谁的方法。
function show(num) {
$("#firstdName>option").val(function() {
if ($(this).val() == num) {
$(this).attr("selected", "true");
}
})
}
昨天你问的时候就回了啊,实验过的,要选择的项的value值传进这个方法就行了
如果你自动添加的select的value和你的例子一样,即value为顺序值,则:
function dosele(int)
{
document.getElementById("firstdName").options[int-1].selected=true;
}如果不是这种对应关系
function dosele(int)
{
var objs=document.getElementById("firstdName").options;
for (i=0;i<objs.length;i++)
{
if (objs[i].value==int) bojs[i].selected=true;
}
}
document.getElementById("firstdName").value='2';无奈结贴?啥意思
function showSf(p) {
$.ajax({
type: "post",
url: "../ajax/ModuleManager.ashx",
dataType: 'json',
data: { op: "showOne", mid: p },
success: function(res) {
$("#sfirst option[value=" + res["ShowOne"][0].ModuleID + "]").attr("selected", true);
GetSecondNode(res["ShowOne"][0].ModuleID);
}
});
} function showSs(p) {
$.ajax({
type: "post",
url: "../ajax/ModuleManager.ashx",
dataType: 'json',
data: { op: "showOne", mid: p },
success: function(res) {
showSf(res["ShowOne"][0].ModuleParentID);
$("#sSecond option[value=" + res["ShowOne"][0].ModuleID + "]").attr("selected", true);
}
});
}
$("#sSecond option[value=" + res["ShowOne"][0].ModuleID + "]").attr("selected", true);
我调用第二个方法 showSs(p) 第一个方法中的 $("#sfirst option[value=" + res["ShowOne"][0].ModuleID + "]").attr("selected", true); 执行了
第二个方法 的 $("#sfirst option[value=" + res["ShowOne"][0].ModuleID + "]").attr("selected", true);
却没执行是什么道理 ?
第一个问题,用JQ比较好解决
$("#firstdName").val("2");
$("#firstdName").val("2");我这样用了 根本就没用
showSf(res["ShowOne"][0].ModuleParentID);
$("#sSecond option[value=" + res["ShowOne"][0].ModuleID + "]").attr("selected", true);
你把这两句前后换下试试呢?
function showSs(p) {
$.ajax({
type: "post",
url: "../ajax/ModuleManager.ashx",
dataType: 'json',
data: { op: "showOne", mid: p },
success: function(res) {
showSf(res["ShowOne"][0].ModuleParentID);
$("#sSecond option[value=" + res["ShowOne"][0].ModuleID + "]").attr("selected", true);
}
});
楼主这段代码在哪里调用的?
IE8、FireFox的Firebug都可以调试js,下个断点,就可以看出问题,你先看sfirst 这里执行后有没有错误,再看sSecond这里能不能找到相应的对象,也就是第2个下拉
function showSr(l, p) {
if (l == 1) {
$("#dfirst").show();
$("#dsecond").hide();
$("#dthird").hide();
$("#first").attr("checked", "true");
}
else if (l == 2) {
$("#dfirst").hide();
$("#dsecond").show();
$("#dthird").hide();
$("#second").attr("checked", "true");
GetFistNode();
showSf(p); } else if (l == 3) {
$("#dfirst").hide();
$("#dsecond").show();
$("#dthird").show();
$("#third").attr("checked", "true");
GetFistNode();
showSs(p);
}
}
$("#sSecond option[value=" + res["ShowOne"][0].ModuleID + "]").attr("selected", true);
从结果上看 应该是没错的
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE> New Document </TITLE>
<META NAME="Generator" CONTENT="EditPlus">
<META NAME="Author" CONTENT="Sandy(阿非)">
<META NAME="Keywords" CONTENT="Sandy,阿非">
<META NAME="Description" CONTENT="">
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
</HEAD> <BODY>
<select id='sel'>
<option value='1'>1</option>
<option value='2'>2</option>
<option value='3'>3</option>
<option value='4'>4</option>
</select>
<br>
<hr>
Method One
<input type='button' value='2被选中' onclick='MethodOne();'/>
<hr>
Method Two
<input type='button' value='3被选中' onclick='MethodTwo();'/>
<script>
function MethodOne()
{
$('#sel')[0].value=2;
}
function MethodTwo()
{
$('#sel option[value=3]').attr("selected","true");
}
</script>
</BODY>
</HTML>
你可用分不少嘛!这么用都没用完~
function showSs(p) {
$.ajax({
type: "post",
url: "../ajax/ModuleManager.ashx",
dataType: 'json',
data: { op: "showOne", mid: p },
success: function(res) {
showSf(res["ShowOne"][0].ModuleParentID);
$("#sSecond option[value=" + res["ShowOne"][0].ModuleID + "]").attr("selected", true);//你res["ShowOne"][0].ModuleID 这个得到的值,在sSecond的option中有没有,且看看这个值有没有带空格。因为是从后台得到的数据,如果数据库的类型问题有可能带空格。
//$("#sSecond option[value=" + res["ShowOne"][0].ModuleID + "]")能否找到这个对象,我记得
//在html中可以这样,$("#sSecond option[value='" + res["ShowOne"][0].ModuleID + "']").attr("selected", "selected");是selected="selected",$("input[attr='value']")
//里面的value最好加上单引号 }
});
}
不行 没有定义 $("#sSecond option[value=" + res["ShowOne"][0].ModuleID + "]").attr("selected", true);
没有用啊 我在获取第一及的时候也是这样写的 $("#sfirst option[value=" + res["ShowOne"][0].ModuleID + "]").attr("selected", true);
第一级它选中了
你的级联效果如果通过cs实现,是一定能行的
如果通过ashx,我这就没把握了。
祝愿大家帮你找到好方法!
<body>
<form name="aspnetForm" method="post" action="ModuleInfo.aspx?op=edit&mid=30" id="aspnetForm">
<div>
<input type="hidden" name="__EVENTTARGET" id="__EVENTTARGET" value="" />
<input type="hidden" name="__EVENTARGUMENT" id="__EVENTARGUMENT" value="" />
<input type="hidden" name="__VIEWSTATE" id="__VIEWSTATE" value="/wEPDwUJODk5OTg5MTY2ZGQKmB9JOzBwRUDso2Ee/i26ADcphg==" />
</div>
<script type="text/javascript">
//<![CDATA[
var theForm = document.forms['aspnetForm'];
if (!theForm) {
theForm = document.aspnetForm;
}
function __doPostBack(eventTarget, eventArgument) {
if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
theForm.__EVENTTARGET.value = eventTarget;
theForm.__EVENTARGUMENT.value = eventArgument;
theForm.submit();
}
}
//]]>
</script>
<script type="text/javascript">
//<![CDATA[
if (typeof(Sys) === 'undefined') throw new Error('ASP.NET Ajax 客户端框架未能加载。');
//]]>
</script>
<script src="/ScriptResource.axd?d=taz9kjotyipL1BfEMLYMIUwcwSt-V39Ps8OjXm-W_z9ojzxqsa9NGQkmRolr275luPKJtc7P3pbajl7PxrrTncl9c2s973ZN4naLy2tp-i0v4hnxeEOMX7buo2F1R0rY0&t=7c2f9dc6" type="text/javascript"></script>
<div>
<table border="0" cellpadding="1" cellspacing="1" width="98%">
<tr>
<td>
<script type="text/javascript">
//<![CDATA[
Sys.WebForms.PageRequestManager._initialize('ctl00$ScriptManager1', document.getElementById('aspnetForm'));
Sys.WebForms.PageRequestManager.getInstance()._updateControls([], [], [], 90);
//]]>
</script>
</td>
</tr>
<tr>
<td>
<table width='98%' border='0' cellpadding='1' cellspacing='1' bgcolor='#CBD8AC' align="center"
style="margin-top: 8px">
<tr bgcolor='#EEF4EA'>
<td background='skin/images/wbg.gif'>
<table border='0' cellpadding='0' cellspacing='0'>
<tr>
<td>
<img src="../skin/images/frame/localGIF.gif" width="20" alt="" /> <a href=""
target="_top">后台管理</a>
</td>
<td>
>> <a href="ModuleManager.aspx" target="_top">模块管理</a> >> <a
href="javascript:void(0);" target="_top">模块信息</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width='98%' border='0' cellpadding='1' cellspacing='1' bgcolor='#CBD8AC' align="center"
style="margin-top: 8px">
<tr bgcolor='#EEF4EA'>
<td background='skin/images/wbg.gif'>
<table border='0' cellpadding='0' cellspacing='0'>
<tr>
<td>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width='98%' border='0' cellpadding='0' cellspacing='0' bgcolor='#CBD8AC' align="center"
style="margin-top: 8px">
<tr bgcolor='#EEF4EA'>
<td background="skin/images/wbg.gif" valign="top" >
<table width="98%" border="0" cellpadding="2" cellspacing="1" bgcolor="#D1DDAA" align="center"
style="margin-top: 8px">
<tr align='center' bgcolor="#FFFFFF" onmousemove="javascript:this.bgColor='#FCFDEE';"
onmouseout="javascript:this.bgColor='#FFFFFF';" height="50px">
<td>
</td>
<td colspan="2" id="title">
</td>
<td align="left">
</td>
</tr>
<tr align='center' bgcolor="#FFFFFF" onmousemove="javascript:this.bgColor='#FCFDEE';"
onmouseout="javascript:this.bgColor='#FFFFFF';">
<td width="20%">
</td>
<td width="20%">
模块名字:
</td>
<td width="40%">
<input type="text" id="txtName" />
</td>
<td width="20%" id="wtxtName" align="left">
</td>
</tr>
<tr align='center' bgcolor="#FFFFFF" onmousemove="javascript:this.bgColor='#FCFDEE';"
onmouseout="javascript:this.bgColor='#FFFFFF';">
<td>
</td>
<td>
模块的级别:
</td>
<td>
<input type="radio" id="first" name="1" />第一级模块
<input type="radio" id="second" name="1" />第二级模块
<input type="radio" id="third" name="1" />第三级模块
</td>
<td id="wlevel" align="left">
</td>
</tr>
<tr align='center' bgcolor="#FFFFFF" onmousemove="javascript:this.bgColor='#FCFDEE';"
onmouseout="javascript:this.bgColor='#FFFFFF';">
<td>
</td>
<td valign="top">
请选择父节点:
</td>
<td>
<div id="dfirst">
第一级目录无父节点
</div>
<div id="dsecond">
第一级模块:
<select id="sfirst">
</select>
</div>
<div id="dthird">
第二级模块:
<select id="sSecond">
</select>
</div>
</td>
<td id="wslevel" align="left">
</td>
</tr>
<tr align='center' bgcolor="#FFFFFF" onmousemove="javascript:this.bgColor='#FCFDEE';"
onmouseout="javascript:this.bgColor='#FFFFFF';">
<td>
</td>
<td>
链接地址:
</td>
<td>
<input type="text" id="txtUrl" />
</td>
<td id="wtxtUrl" align="left">
</td>
</tr>
<tr align='center' bgcolor="#FFFFFF" onmousemove="javascript:this.bgColor='#FCFDEE';"
onmouseout="javascript:this.bgColor='#FFFFFF';">
<td>
</td>
<td>
模块描述:
</td>
<td>
<textarea id="txtDes" rows="7" cols="50"></textarea>
</td>
<td id="wtxtDes">
</td>
</tr>
<tr align='center' bgcolor="#FFFFFF" onmousemove="javascript:this.bgColor='#FCFDEE';"
onmouseout="javascript:this.bgColor='#FFFFFF';">
<td>
</td>
<td colspan="2">
<input type="button" id="btnSave" />
<input type="button" id="btnBack" value=" 返回 " />
</td>
<td>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</div>
<script type="text/javascript">
//<![CDATA[
Sys.Application.initialize();
//]]>
</script>
</form>
</body>
</html>
function showSs(p) {
$.ajax({
type: "post",
url: "../ajax/ModuleManager.ashx",
dataType: 'json',
data: { op: "showOne", mid: p },
success: function(res) {
showSf(res["ShowOne"][0].ModuleParentID);
$("#sSecond option[value=" + res["ShowOne"][0].ModuleID + "]").attr("selected", true);//你res["ShowOne"][0].ModuleID 这个得到的值,在sSecond的option中有没有,且看看这个值有没有带空格。
//因为是从后台得到的数据,如果数据库的类型问题有可能带空格。
//$("#sSecond option[value=" + res["ShowOne"][0].ModuleID + "]")能否找到这个对象,
//我记得在html中可以这样,$("#sSecond option[value='" + res["ShowOne"][0].ModuleID + "']").attr("selected", "selected");
//是selected="selected",$("input[attr='value']")里面的value最好加上单引号 }
});
}
$(function() {
var modeId = -1;
var op = "";
var level = -1;
var urlinfo = window.location.href; //获取当前页面的url
if (urlinfo == "" || urlinfo == null) {
location = "ModuleManager.aspx";
}
var len = urlinfo.length; //获取url的长度
var offset = urlinfo.indexOf("?"); //设置参数字符串开始的位置
if (offset > 0) {
var newsidinfo = urlinfo.substr(offset, len); //取出参数字符串 这里会获得类似“id=1”这样的字符串
var newsids = newsidinfo.split("="); //对获得的参数字符串按照“=”进行分割
if (newsids[1].indexOf("&") > 0) {
op = newsids[1].split("&")[0];
}
modeId = newsids[2];
}
else {
op = "add";
}
if (op == "edit") {
$("#first").attr("disabled", true);
$("#second").attr("disabled", true);
$("#third").attr("disabled", true);
var pid = -1;
$("#btnSave").val(" 修改 ");
$.ajax({
type: "post",
url: "../ajax/ModuleManager.ashx",
dataType: 'json',
data: { op: "showOne", mid: modeId },
success: function(res) {
$(res["ShowOne"]).each(function(i, node) {
$("#txtName").val(node.ModuleName);
$("#txtUrl").val(node.ModuleUrl);
$("#txtDes").val(node.ModuleDes);
level = node.ModuleType;
pid = node.ModuleParentID;
showSr(level, pid);
});
}
});
}
else {
op = "add";
$("#first").attr("enabled", true);
$("#second").attr("enabled", true);
$("#third").attr("enabled", true);
$("#dfirst").hide();
$("#dsecond").hide();
$("#dthird").hide();
$("#btnSave").val(" 添加 ");
var level = 0;
}
$("#first").bind("click", function() {
level = 1;
$("#dfirst").show();
$("#dsecond").hide();
$("#dthird").hide();
});
$("#second").bind("click", function() {
level = 2;
$("#dfirst").hide();
$("#dsecond").show();
$("#dthird").hide();
GetFistNode();
});
$("#third").bind("click", function() {
level = 3;
$("#dfirst").hide();
$("#dsecond").show();
$("#dthird").show();
GetFistNode();
GetSecondNode($("#sfirst").val());
});
$("#sfirst").bind("change", function() {
GetSecondNode($("#sfirst").val());
});
$("#btnSave").bind("click", function() {
$("#wtxtName").html("");
$("#wlevel").html("");
$("#wtxtUrl").html("");
$("#wslevel").html("");
var txtName = $("#txtName").val();
if (txtName == "") {
$("#wtxtName").html("<span style='color:Red;'>请输入模块的名称!</span>");
return;
}
if (txtName.length > 5) {
$("#wtxtName").html("<span style='color:Red;'>请输入4-5个汉字!</span>");
return;
}
if (level == 0) {
$("#wlevel").html("<span style='color:Red;'>请选择模块的级别!</span>");
return;
}
if (level > 1) {
if ($("#sfirst").val() == "0") {
$("#wslevel").html("<span style='color:Red;'>请选择第一级模块!</span>");
return;
}
}
if (level == 3) {
if ($("#sSecond").val() == "0") {
$("#wslevel").html("<span style='color:Red;'>请选择第二级模块!</span>");
return;
}
if ($("#txtUrl").val() == "") {
$("#wtxtUrl").html("<span style='color:Red;'>请输入链接地址!</span>");
return;
}
}
if ($("#txtDes").val().length > 50) {
$("#wtxtDes").html("<span style='color:Red;'>描述请不要超过50个汉字!</span>");
return;
}
if (op == "add") {
$.ajax({
url: '../ajax/ModuleManager.ashx',
type: 'post',
dataType: "json",
data: { op: op, level: level, txtName: txtName, firstdName: $("#sfirst").val(), secondName: $("#sSecond").val(), txtLink: $("#txtUrl").val(), txtDes: $("#txtDes").val() },
success: function(res) {
alert(res.msg);
location = "ModuleManager.aspx";
},
error: function(res) {
alert(res);
}
});
}
else if (op == "edit") {
$.ajax({
url: '../ajax/ModuleManager.ashx',
type: 'post',
dataType: "json",
data: { op: op, level: level, modeId: modeId, txtName: txtName, firstdName: $("#sfirst").val(), secondName: $("#sSecond").val(), txtLink: $("#txtUrl").val(), txtDes: $("#txtDes").val() },
success: function(res) {
alert(res.msg);
location = "ModuleManager.aspx";
},
error: function(res) {
alert(res);
}
});
}
});
$("#btnBack").bind("click", function() {
location = "ModuleManager.aspx";
});
});
function showSf(p) {
$.ajax({
type: "post",
url: "../ajax/ModuleManager.ashx",
dataType: 'json',
data: { op: "showOne", mid: p },
success: function(res) {
$("#sfirst option[value=" + res["ShowOne"][0].ModuleID + "]").attr("selected", true);
GetSecondNode(res["ShowOne"][0].ModuleID);
}
});
}
function showSs(p) {
$.ajax({
type: "post",
url: "../ajax/ModuleManager.ashx",
dataType: 'json',
data: { op: "showOne", mid: p },
success: function(res) {
showSf(res["ShowOne"][0].ModuleParentID);
$("#sSecond option[value=" + res["ShowOne"][0].ModuleID + "]").attr("selected", true);
alert($("#sSecond option[value=" + res["ShowOne"][0].ModuleID + "]").val());
}
});
}
function showSr(l, p) {
if (l == 1) {
$("#dfirst").show();
$("#dsecond").hide();
$("#dthird").hide();
$("#first").attr("checked", "true");
}
else if (l == 2) {
$("#dfirst").hide();
$("#dsecond").show();
$("#dthird").hide();
$("#second").attr("checked", "true");
GetFistNode();
showSf(p);
} else if (l == 3) {
$("#dfirst").hide();
$("#dsecond").show();
$("#dthird").show();
$("#third").attr("checked", "true");
GetFistNode();
showSs(p);
}
}
function GetFistNode() {
$.ajax({
type: "post",
url: "../ajax/ModuleManager.ashx?op=first",
dataType: 'json',
success: function(res) {
var h = "<option value=\"0\">------请选择------</option>";
$(res["FirstNode"]).each(function(i, first) {
h += "<option value=\"" + first.ModuleID + "\">" + first.ModuleName + "</option>";
});
$("#sfirst").html(h);
}
});
}
function GetSecondNode(mid) {
if (mid == "0" || mid == null) {
$("#sSecond").html("<option value=\"0\">------请选择------</option>");
return;
}
$.ajax({
type: "post",
url: "../ajax/ModuleManager.ashx?op=second&mid=" + mid,
dataType: 'json',
success: function(res) {
var h = "<option value=\"0\">------请选择------</option>";
$(res["SecondNode"]).each(function(i, first) {
h += "<option value=\"" + first.ModuleID + "\">" + first.ModuleName + "</option>";
});
$("#sSecond").html(h);
}
});
}
</script>
得到的没错
$("#sSecond option[value='" + res["ShowOne"][0].ModuleID + "']").attr("selected", true);
alert(res["ShowOne"][0].ModuleID);
俩个都执行了
既然第一及可以显示 说明 JSON的数据没错啊
GetSecondNode($("#sfirst").val());GetFistNode();
showSf(p);
.......你那个showone是返回的默认值吧?为什么不直接写在GetSecondNode GetFistNode里呢?
你是先调GetSecondNode 绑定下拉框 , 然后在再获取默认值,本来是可以的,关键是你这样写不对你写的是同时调两个ajax,会一个前一个后的,并不一定是写在下面的那个方法会后执行,你的执行showSf的时候,如果没有获取到第一个的值,当然就选不中了
可以在绑定下拉框数据的事件里写 showSf(p); showSs你看看是不是这个原因
$("#sSecond option[value=" + res["ShowOne"][0].ModuleID + "]").attr("selected", true);关键是这个代码失效了 就是没做用
res["ShowOne"][0].ModuleID
这个东西到是没错返回的数据是正确的
可哪句话就问题很大了
感觉没执行 应该说根本就好象没执行一样
showSf() 写在上个方法的下一行,当数据返回成功后他会去遍历sSecond 的下拉框,然后绑定默认值由于ajax是异步执行的,所以你这样写并不敢保证你第2步一定是第一步完全结束后才操作的,明白了吗你这句
$("#sSecond option[value=" + res["ShowOne"][0].ModuleID + "]").attr("selected", true);由于sSecond 下拉框还没有绑定完,所以根本找不到 res["ShowOne"][0].ModuleID 这个值,alert($("#sSecond option[value=" + res["ShowOne"][0].ModuleID + "]").val()) 肯定要报错,因为没找到
function showSs(p) {
$.ajax({
type: "post",
url: "../ajax/ModuleManager.ashx",
dataType: 'json',
data: { op: "showOne", mid: p },
success: function(res) {
showSf(res["ShowOne"][0].ModuleParentID);
$("#sSecond option[value=" + res["ShowOne"][0].ModuleID + "]").attr("selected", true);
//alert($("#sSecond option[value=" + res["ShowOne"][0].ModuleID + "]").val());
//这里看一下第2个下拉框的值到底改变了没有
alert($("#sSecond ").html())
}
});
}