<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>无标题页</title>
<script language="JavaScript" type="text/javascript">
var xmlHttp;
var serverpage = "http://www.baidu.com";function createXMLHttpRequest(){
if(window.ActiveXObject){
xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
}
else if(window.ActiveXObject){
xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
}
else if(window.XMLHttpRequest){
xmlHttp = new XMLHttpRequest();
}
}function startRequest(){
createXMLHttpRequest();
try{
xmlHttp.onreadystatechange = handleStateChange;
xmlHttp.open("GET", serverpage , true);
xmlHttp.send(null);
}catch(exception){
alert("您要访问的资源不存在!");
}
}function handleStateChange(){
if(xmlHttp.readyState == 4){
if (xmlHttp.status == 200 || xmlHttp.status == 0){
var mystring = xmlHttp.responseText;
var begin = mystring.indexOf("<title\>");
var end = mystring.indexOf("<\/title>");
alert(mystring.substring(begin+7,end))
}
}
}
startRequest();
</script>
</head>
<body style="background-color:Transparent" >
</body>
</html>
这段代码可以获得任意URL页面的title,但是在火狐下不通过,求大虾们帮我看下什么原因,怎么进行调整!
然后获得title
window.frames['frameName'].document.title
我刚才试了下jQuery的IE下可以,FF下还是不通过。目前仍没有找到好的解决办法。