当页面加载日历对象时显示在表单上。但是当我从 onchange 事件调用 ajax 函数来选择一个城市时,在 ajax 调用之后日历不会显示在页面上。ajax 代码如下:
<script language="JavaScript">
function redirect()
{
window.location='adm_regemployeelist.php';
}
function selectcity()
{
var empid=document.getElementById("empid").value;
var empname=document.getElementById("empname").value;
var addr=document.getElementById("addr").value;
var addr1=document.getElementById("addr1").value;
var city=document.getElementById("city").value;
if(addr==''||empid==''||empname=='')
{
alert("Please Fill Out Empty Fields\n\n");
return false;
}
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById("container").innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET","emp_registration.php?empid="+empid+"&empname="+empname+"&addr="+addr+"&addr1="+addr1+"&city="+city,true);
xmlhttp.send();
}
</script>