以下是JS代码:CSS={AddClass:function(e,c){if(!e.className.match(new RegExp("\\b"+c+"\\b","i")))e.className+=(e.className?" ":"")+c;},RemoveClass:function(e,c){e.className=e.className.replace(new RegExp(" \\b"+c+"\\b|\\b"+c+"\\b ?","gi"),"");}};Tabs={GoTo:function(contentId,skipReplace){var foundTab=false;var toc=document.getElementById("toc");if(toc){var lis=toc.getElementsByTagName("li");for(var j=0;j<lis.length;j++){var li=lis[j];var anchors=li.getElementsByTagName("a");for(var k=0;k<anchors.length;k++){if(anchors[k].hash=="#"+contentId){CSS.AddClass(li,"current");foundTab=true;break;}else{CSS.RemoveClass(li,"current");}}}}var divsToHide=[];var divs=document.getElementsByTagName("div");for(var i=0;i<divs.length;i++){var div=divs[i];if(div.className.match(/\bcontent\b/i)){if(div.id=="_"+contentId)div.style.display="block";else divsToHide.push(div);}}for(var i=0;i<divsToHide.length;i++)divsToHide[i].style.display="none";if(!skipReplace)window.location.replace("#"+contentId);},OnClickHandler:function(e){if(!e)e=window.event;if(e.preventDefault)e.preventDefault();else e.returnValue=false;Tabs.GoTo(this.hash.substring(1));},Init:function(){if(!document.getElementsByTagName)return;var anchors=document.getElementsByTagName("a");for(var i=0;i<anchors.length;i++){var a=anchors[i];if(a.hash)a.onclick=Tabs.OnClickHandler;}var contentId;if(window.location.hash)contentId=window.location.hash.substring(1);var divs=document.getElementsByTagName("div");for(var i=0;i<divs.length;i++){var div=divs[i];if(div.className.match(/\bcontent\b/i)){if(!contentId)contentId=div.id;div.id="_"+div.id;}}if(contentId)Tabs.GoTo(contentId,true);}};FeedbackForm={RequestStatus:null,RequestStatusText:null,Request:null,Init:function(){var span=document.createElement("span");span.className="requestStatus";FeedbackForm.RequestStatus=span;var text=document.createTextNode("");span.appendChild(text);FeedbackForm.RequestStatusText=text;var button=document.getElementById("SubmitFeedback");button.parentNode.appendChild(span);var form=document.getElementById("FeedbackForm");if(form)form.onsubmit=FeedbackForm.OnSubmitHandler;},OnRequestEventHandler:function(){switch(FeedbackForm.Request.readyState){case 4:var d=FeedbackForm.Request.responseText;if(d.substring(0,2)=="OK"){FeedbackForm.RequestStatus.style.color="#080";document.getElementById("Name").value="";document.getElementById("Email").value="";document.getElementById("Message").value="";d=d.substring(3);}else{FeedbackForm.RequestStatus.style.color="#c00";}FeedbackForm.RequestStatusText.nodeValue=d;document.getElementById("Name").disabled="";document.getElementById("Email").disabled="";document.getElementById("Message").disabled="";document.getElementById("SubmitFeedback").disabled="";break;}},OnSubmitHandler:function(){var r=null;if(FeedbackForm.Request){r=FeedbackForm.Request;}else{if(window.XMLHttpRequest){try{r=new XMLHttpRequest();}catch(e){r=null;}}if(!r&&window.ActiveXObject){try{r=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{r=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){r=null;}}}if(!r&&window.createRequest){try{r=window.createRequest();}catch(e){r=null;}}FeedbackForm.Request=r;}if(!r)return true;document.getElementById("Name").disabled="disabled";document.getElementById("Email").disabled="disabled";document.getElementById("Message").disabled="disabled";document.getElementById("SubmitFeedback").disabled="disabled";FeedbackForm.RequestStatus.style.color="#000";FeedbackForm.RequestStatusText.nodeValue="Please wait...";r.open("POST","feedback.php?xhr=1",true);r.onreadystatechange=FeedbackForm.OnRequestEventHandler;r.setRequestHeader("Content-Type","application/x-www-form-urlencoded");r.send("name="+encodeURIComponent(document.getElementById("Name").value)+"&email="+encodeURIComponent(document.getElementById("Email").value)+"&message="+encodeURIComponent(document.getElementById("Message").value));return false;}};window.onload=function(){Tabs.Init();FeedbackForm.Init();};var contentId=window.location.hash||"#Introduction";if(document.createStyleSheet){var style=document.createStyleSheet();style.addRule("div.content","display: none;");style.addRule("div"+contentId,"display: block;");}else{var head=document.getElementsByTagName("head")[0];if(head){var style=document.createElement("style");style.setAttribute("type","text/css");style.appendChild(document.createTextNode("div.content { display: none; } div"+contentId+" { display: block; }"));head.appendChild(style);}}上面的是独立的一个JS文件,在PHP中调用此JS,用IE8打开时,左下角会被提示如下:
网页错误详细信息用户代理: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0; QQDownload 1.7)
时间戳: Fri, 8 Apr 2011 12:42:32 UTC
消息: 缺少对象
行: 1
字符: 1967
代码: 0
URI: http://localhost/yp/js/tabs_optimized.js
请问怎样解决?怎样修改JS?