在Firefox不支持,有没有解决办法
以下代码在IE执行正常,在FIREFOX不支持。。有什么方法可以支持吗?
1.asp
----------------------------------------------------------------
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>测试</title>
<script language="JavaScript" src="returnhtm.js" type="text/javascript"></script>
</head>
<body>
<div id="temp">abc</div>
<script>
getshow('2.asp','temp');
</script>
</body>
</html>
----------------------------------------------------------------
returnhtm.js
----------------------------------------------------------------
var filesadded = ""
//创建XMLHttpRequest对象
var http = window.ActiveXObject ? new ActiveXObject("Microsoft.XMLHTTP") : new XMLHttpRequest();
function getshow(url,div_name){
document.getElementById(div_name).innerHTML="<img src=images/loading.gif />载入数据中......";
http.open("GET",url,false);
http.onreadystatechange=function(){gethandleHttpResponse(div_name)};
http.setRequestHeader("Content-Type","text/html;encoding=GB2312");
http.send(null);
return;
}
function postshow(url,div_name,parameter){
document.getElementById(div_name).innerHTML="<img src=images/loading.gif />载入数据中......";
http.open("POST",url,false);
http.onreadystatechange=function(){gethandleHttpResponse(div_name)};
http.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
http.send(parameter);
return;
}
function gethandleHttpResponse(div_name){
if(http.readyState==4){
if(http.status==200){
if(http.responseText!=""){
htmlText=http.responseText;
var DomJs=htmlText.match(/<load-js>[\s\S]+?<\/load-js>/g);//获取载入JS文件
var DomCss=htmlText.match(/<load-css>[\s\S]+?<\/load-css>/g);//获取载入CSS文件
var DomScript=htmlText.match(/<load-script>[\s\S]+?<\/load-script>/g);//获取载入函数
var MyScript=htmlText.match(/<run-script>[\s\S]+?<\/run-script>/g);//获取执行语句
htmlText=htmlText.replace(/<load-js>[\s\S]+?<\/load-js>/g,"")//删除载入JS文件文本
htmlText=htmlText.replace(/<load-css>[\s\S]+?<\/load-css>/g,"")//删除载入CSS文件文本
htmlText=htmlText.replace(/<load-script>[\s\S]+?<\/load-script>/g,"")//删除载入函数文本
htmlText=htmlText.replace(/<run-script>[\s\S]+?<\/run-script>/g,"")//删除执行语句文本
document.getElementById(div_name).innerHTML=htmlText;//输出文本
//载入JS文件,以<load-js>开头</load-js>结束
if(DomJs!=null){
for(i=0;i<DomJs.length;i++){
DomJs[i]=DomJs[i].replace(/<load-js>/g,"");
DomJs[i]=DomJs[i].replace(/<\/load-js>/g,"");
if (filesadded.indexOf("["+DomJs[i]+"]")==-1){
var headerDom=document.getElementsByTagName('head')[0];
var jsDom=document.createElement('script');
jsDom.setAttribute("type","text/javascript");
jsDom.setAttribute("src",DomJs[i]);
headerDom.appendChild(jsDom);
filesadded += "["+DomJs[i]+"]";
}
}
}
//载入CSS文件,以<load-css>开头</load-css>结束
if(DomCss!=null){
for(i=0;i<DomCss.length;i++){
DomCss[i]=DomCss[i].replace(/<load-css>/g,"");
DomCss[i]=DomCss[i].replace(/<\/load-css>/g,"");
if (filesadded.indexOf("["+DomCss[i]+"]")==-1){
var headerDom=document.getElementsByTagName('head')[0];
var jsDom=document.createElement('link');
jsDom.setAttribute("rel", "stylesheet");
jsDom.setAttribute("type","text/javascript");
jsDom.setAttribute("href",DomCss[i]);
headerDom.appendChild(jsDom);
filesadded += "["+DomCss[i]+"]";
}
}
}
//载入JS函数,以<load-script>开头</load-script>结束
if(DomScript!=null){
for(i=0;i<DomScript.length;i++){
DomScript[i]=DomScript[i].replace(/<load-script>/g,"");
DomScript[i]=DomScript[i].replace(/<\/load-script>/g,"");
var headerDom=document.getElementsByTagName('head').item(0);
var jsDom=document.createElement('script');
jsDom.type='text/javascript';
jsDom.language='javascript';
jsDom.defer=true;
jsDom.text=DomScript[i];
headerDom.appendChild(jsDom);
}
}
//执行JS,以<run-script>开头</run-script>结束
if(MyScript!=null){
for(i=0;i<MyScript.length;i++){
MyScript[i]=MyScript[i].replace(/<run-script>/g,"");
MyScript[i]=MyScript[i].replace(/<\/run-script>/g,"");
eval(MyScript[i]);
}
}
}
}else{document.getElementById(div_name).innerHTML="你所请求的页面发生异常,可能会影响你浏览该页的信息!"+http.status;}
}
}
----------------------------------------------------------------
2.asp
----------------------------------------------------------------
111111111111111111111111
----------------------------------------------------------------