function SelectLineList() {
var str = window.showModalDialog("../../ModalDialog/Sys_BusLineList.aspx", "", "dialogWidth:650px;dialogHeight:400px");//接收值
if (str !== undefined) {
//移除下拉框的子项
$("#ctl00_ContentPlaceHolder1_DDStation").find("option").each(function() {
$(this).remove();
});
var len = $("select[@name='#ctl00$ContentPlaceHolder1$DDStation'] option").length;
var arr = str.replace('^*#', '\'').split('|');
if (arr.length > 0) {
var data = "type=LineList&UpLine=" + arr[2];
var result = $.ajax({ url: "../../Common/ShareChange.aspx",
type: "POST",
data: data,
async: false
}).responseText;
var myOptions = result.split(',');
//给下拉框添加子项
for (var i = 0; i < myOptions.length; i++) {
var ValueText = myOptions[i].split(':');
$('#ctl00_ContentPlaceHolder1_DDStation').append($('<option></option>').val(ValueText[0]).html(ValueText[1]));
}
//选择某个子项时触发
$("#ctl00_ContentPlaceHolder1_DDStation").change(function() {
$("#ctl00_ContentPlaceHolder1_HDStatoinID").val($(this).val());
});
$("#ctl00_ContentPlaceHolder1_txtBusLine").val(arr[1]); //公交名称
$("#ctl00_ContentPlaceHolder1_HDLineID2").val(arr[0]); //线路ID
$("#ctl00_ContentPlaceHolder1_txtBusStation").val(arr[3]); //整个线路
}
}
}
下拉框的添加,移除,选项的触发。。。。
最新推荐文章于 2019-08-22 12:12:00 发布