<script type="text/javascript">
function BindDrpList(para) {
// var sid = document.getElementById("hdn_Id").value;
$.ajax({
type: "get",
url: "AjaxMachineHandler.ashx?t=" + Math.random(),
data: { stype: "drpListSearch", "para": para }, //encodeURI("name")
dataType: "json",
contentType: "application/json",
success: function (data) {
var ddl
if (para == "") {
ddl = $("#drppara");
}
else {
ddl = $("#drpstype");
}
//删除节点
RemoveOption(ddl[0].id);
//转成Json对象
var result = eval(data);
ddl[0].options.add(new Option("请选择", ""));
//第三种方法
$.each(result, function (key, value) {
// alert("dd");
var op = new Option(value.text, value.value);
ddl[0].options.add(op);
});
},
complete: function (aa, bb) {
arr = aa;
}
});
//初始化起止时间
var time = new Date(); //Tue Oct 21 13:42:15 UTC+0800 2014 2014-10-21 13:00:00
var year = time.getFullYear();
var month = time.getMonth() + 1;
var day = time.getDate();
var h = time.getHours();
var min = time.getMinutes();
document.getElementById("txt_start").value = year + "-" + month + "-" + day + " 00:00:00";
document.getElementById("txt_end").value = year + "-" + month + "-" + day + " " + h + ":" + min + ":00";
}
function RemoveOption(id) {
$("#" + id + " option").remove();
}
</script>