首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > JavaScript >

Ajax缺少对象,该怎么处理

2012-04-25 
Ajax缺少对象onclickjavascript:showDiv(HU,N,1) onmouseouthideThisDiv()script language

Ajax缺少对象
onclick="javascript:showDiv('HU','N',1);" onmouseout="hideThisDiv();">

<script language=JavaScript type="text/javascript" src="../js/FlightAjax.js"></script>
<script src="../JS/jquery.js" type="text/javascript" ></script>

JScript code
function showDiv(ojb,kjb,id){Mid="M"+id;$.ajax({   type: "POST",     url: "../Domestic/getair.aspx",     data: "aircode="+ojb+"&airclass="+kjb,     success: function(result){      // alert( "Data Saved: " + result );  displayHotelDiv(result,Mid);   } }); }//FlightAjax.jsvar thisLayer = document.createElement("div");with (thisLayer.style) {    position = "absolute";    left = "0px";    top = "0px";    margin = "0px";    width = "0%";    height = "0%";    //background = "#0066CC";    //filter = "Alpha(Opacity=30)";    //padding = "0px";    //clip = "rect(0px,auto,auto,auto)";}thisLayer.setAttribute("onclick",function(){hideDisposeDiv();});var thisBody = document.getElementsByTagName("body")[0];var thisDiv = document.createElement("div");thisDiv.style.position = "absolute";thisDiv.style.display = "none";var thisTable = document.createElement("table");var thisTbody = document.createElement("tbody");//thisTable.className = "td1";var thisTr1 = document.createElement("tr");var thisTr2 = document.createElement("tr");var thisTr3 = document.createElement("tr");var thisTr4 = document.createElement("tr");var thisTd1 = document.createElement("td");thisTd1.colspan="2";thisTr1.appendChild(thisTd1); var thisTd3 = document.createElement("td");var thisTd4 = document.createElement("td");thisTr2.appendChild(thisTd3);thisTr2.appendChild(thisTd4);var thisTd5 = document.createElement("td");var thisTd6 = document.createElement("td");thisTr3.appendChild(thisTd5);thisTr3.appendChild(thisTd6);var thisTd7 = document.createElement("td");var thisTd8 = document.createElement("td");thisTr4.appendChild(thisTd7);thisTr4.appendChild(thisTd8);thisTbody.appendChild(thisTr1);thisTbody.appendChild(thisTr2);thisTbody.appendChild(thisTr3);thisTbody.appendChild(thisTr4);thisTable.appendChild(thisTbody);thisDiv.appendChild(thisTable);thisBody.appendChild(thisLayer);thisBody.appendChild(thisDiv); function displayHotelDiv(inputMsg,did){    var eT=0,eL=0,p=document.getElementById(did);    thisTable.setAttribute("onclick",function(){hideDisposeDiv();});    if(document.body.scrollTop!=0 || (document.documentElement.scrollTop==0 && document.documentElement.clientHeight==0))    {        var sT=document.body.scrollTop,sL=document.body.scrollLeft;        var eH=p.height,eW=p.width;        while(p&&p.tagName!="BODY"){eT+=p.offsetTop;eL+=p.offsetLeft;p=p.offsetParent;}        thisDiv.style.top=((document.body.clientHeight-(eT-sT)-eH>=25)?eT+eH:eT-25) + "px";        thisDiv.style.left=((document.body.clientWidth-(eL-sL)>=25)?eL:eL+eW) + "px";        }else{        var sT=document.documentElement.scrollTop,sL=document.documentElement.scrollLeft;        var eH=p.height,eW=p.width;        while(p&&p.tagName!="BODY"){eT+=p.offsetTop;eL+=p.offsetLeft;p=p.offsetParent;}        thisDiv.style.top=((document.documentElement.clientHeight-(eT-sT)-eH>=25)?eT+eH:eT)+18+ "px";        thisDiv.style.left=((document.documentElement.clientWidth-(eL-sL)>=100)?eL-150:eL+eW) + "px";        }    thisLayer.style.width = "100";    thisLayer.style.height = "100";        if (inputMsg != undefined) {        var count=inputMsg.split(",");        var info="<table width='300' border='0' cellpadding='0' cellspacing='0' style='BORDER-RIGHT: #A4D1FF 1px solid; BORDER-TOP: #A4D1FF 1px solid; BORDER-LEFT: #A4D1FF 1px solid; BORDER-BOTTOM: #A4D1FF  1px solid; BACKGROUND-COLOR: #EEF7FF;'>";        info+="<tr><td colspan='2'><table width='280' border='0' align='center' cellpadding='0' cellspacing='0'><tr><td height='28' colspan='2'><b>退改签规定</b></td></tr><tr>";        info+="<td height='1' colspan='2' bgcolor='#A4D1FF'></td></tr><tr><td height='5' colspan='2' valign='top'></td></tr><tr>";        info+="<td width='67' height='26' valign='top'><b>更改条件:</b></td><td width='213' valign='top'>"+count[0]+"</td></tr>";        info+="<tr><td height='26' valign='top'><b>退票条件:</b></td><td valign='top'>"+count[1]+"</td></tr>";        info+="<tr><td height='26' valign='top'><b>签转条件:</b></td><td valign='top'>"+count[2]+"</td></tr></table></td></tr>";        info+="</table>";        info+="<iframe src='javascript:false' frameborder='0' style='position:absolute;top:0px;left:0px; width:380px; height:70px; z-index:-1;'>";        info+="</iframe>";        thisDiv.innerHTML=info;        thisDiv.style.display = "";    }}function hideThisDiv(){    thisDiv.style.display = "none";    thisDiv.style.left = 0;    thisDiv.style.top = 0;    thisLayer.style.width = "0%";    thisLayer.style.height = "0%";} 


总是提示FlightAjax.js缺少对象

[解决办法]
JScript code
仔细检查是不是id不存在之内的 

热点排行