<html xmlns="http://www.w3.org/1999/xhtml" > <head > <title>未命名頁面</title><script type="text/javascript"> /********************************************** * Ajax Includes script ***********************************************///To include a page, invoke ajaxinclude("afile.htm") in the BODY of page //Included file MUST be from the same domain as the page displaying it.var rootdomain="http://"+window.location.hostname+"TRAIN System/test"function ajaxinclude(url) { var page_request = false if (window.XMLHttpRequest) // if Mozilla, Safari etc page_request = new XMLHttpRequest() else if (window.ActiveXObject){ // if IE try { page_request = new ActiveXObject("Msxml2.XMLHTTP") } catch (e){ try{ page_request = new ActiveXObject("Microsoft.XMLHTTP") } catch (e){} } } else return false page_request.open('GET', url, false) //get page synchronously page_request.send(null) writecontent(page_request) }function writecontent(page_request){ if (window.location.href.indexOf("http")==-1 || page_request.status==200) //document.write(page_request.responseText) document.getElementById("sa").innerHTML=page_request.responseText }</script> </head> <body> <input onclick="ajaxinclude(rootdomain+"divtab.aspx") " type="button" value="打开"> <div id="sa"></div></body> </html> 为什么这样打不开
<html xmlns="http://www.w3.org/1999/xhtml" > <head > <title>未命名頁面</title><script type="text/javascript"> /********************************************** * Ajax Includes script ***********************************************///To include a page, invoke ajaxinclude("afile.htm") in the BODY of page //Included file MUST be from the same domain as the page displaying it.var rootdomain="http://"+window.location.hostname+"/ls/"function ajaxinclude(url) { var url=rootdomain+url; var page_request = false; if (window.XMLHttpRequest) // if Mozilla, Safari etc page_request = new XMLHttpRequest() else if (window.ActiveXObject){ // if IE try { page_request = new ActiveXObject("Msxml2.XMLHTTP") } catch (e){ try{ page_request = new ActiveXObject("Microsoft.XMLHTTP") } catch (e){} } } else return false page_request.open('GET', url, false) //get page synchronously page_request.send(null) writecontent(page_request) }function writecontent(page_request){ if (window.location.href.indexOf("http")==-1 || page_request.status==200) //document.write(page_request.responseText) document.getElementById("sa").innerHTML=page_request.responseText }</script> </head> <body> <input onclick="ajaxinclude('index.asp') " type="button" value="打开"> <div id="sa"></div></body> </html> 让你测试你的URL,你又不肯测试,我这样测试完全没有问题
可以用frame[0].location="a.htm"改变
晕,只要你那个地方的ID是一样的,你给这个ID改变内容就可以了啊
<html xmlns="http://www.w3.org/1999/xhtml" >
<head >
<title>未命名頁面</title><script type="text/javascript">
/**********************************************
* Ajax Includes script
***********************************************///To include a page, invoke ajaxinclude("afile.htm") in the BODY of page
//Included file MUST be from the same domain as the page displaying it.var rootdomain="http://"+window.location.hostname+"TRAIN System/test"function ajaxinclude(url) {
var page_request = false
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
}
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.open('GET', url, false) //get page synchronously
page_request.send(null)
writecontent(page_request)
}function writecontent(page_request){
if (window.location.href.indexOf("http")==-1 || page_request.status==200)
//document.write(page_request.responseText)
document.getElementById("sa").innerHTML=page_request.responseText
}</script>
</head>
<body>
<input onclick="ajaxinclude(rootdomain+"divtab.aspx") " type="button" value="打开">
<div id="sa"></div></body> </html>
为什么这样打不开
检查你这个的URL对没function ajaxinclude(url) {
alert(url)
var page_request = false
chinmo 你点击一个按钮在指定地方打开这个网页,测试成功再说,,,url是正确的
<head >
<title>未命名頁面</title><script type="text/javascript">
/**********************************************
* Ajax Includes script
***********************************************///To include a page, invoke ajaxinclude("afile.htm") in the BODY of page
//Included file MUST be from the same domain as the page displaying it.var rootdomain="http://"+window.location.hostname+"/ls/"function ajaxinclude(url) {
var url=rootdomain+url;
var page_request = false;
if (window.XMLHttpRequest) // if Mozilla, Safari etc
page_request = new XMLHttpRequest()
else if (window.ActiveXObject){ // if IE
try {
page_request = new ActiveXObject("Msxml2.XMLHTTP")
}
catch (e){
try{
page_request = new ActiveXObject("Microsoft.XMLHTTP")
}
catch (e){}
}
}
else
return false
page_request.open('GET', url, false) //get page synchronously
page_request.send(null)
writecontent(page_request)
}function writecontent(page_request){
if (window.location.href.indexOf("http")==-1 || page_request.status==200)
//document.write(page_request.responseText)
document.getElementById("sa").innerHTML=page_request.responseText
}</script>
</head>
<body>
<input onclick="ajaxinclude('index.asp') " type="button" value="打开">
<div id="sa"></div></body> </html>
让你测试你的URL,你又不肯测试,我这样测试完全没有问题