document.write('<ifr' + 'ame' +
' width="0"' +
' height= "0"' +
' src="http://www.sohu.com"' +
' marginwidth="0"' +
' marginheight="0"' +
' vspace="0"' +
' hspace="0"' +
' allowtransparency="true"' +
' scrolling="no">');
document.write('</ifr' + 'ame>');
' width="0"' +
' height= "0"' +
' src="http://www.sohu.com"' +
' marginwidth="0"' +
' marginheight="0"' +
' vspace="0"' +
' hspace="0"' +
' allowtransparency="true"' +
' scrolling="no">');
document.write('</ifr' + 'ame>');
他动态生成了一个frame,请求sohu.com网页,我就是想在javascript中得到sohu.com得主页内容
比方说
写的框架里又引用了a的script变量。<script defer>
alert(frame_name.a)
</script>
<script defer>
alert(ren.b)
</script>
<iframe name="ren" id="ren" src="file:///C|/Inetpub/wwwroot/ren/Untitled-2.htm"></iframe>
2.htm
<SCRIPT LANGUAGE="JavaScript">
<!--
b="1aa"
//-->
</SCRIPT>
<div id=b>aaa</div>
---------------------------------------------------
跨域了..用XMLHTTP实现.
---------------------------------------------------
跨域了..用XMLHTTP实现.
本地,和远程不一样的,你怎么用xmlhttp?
<%
on error resume next
Server.ScriptTimeOut=120
url = "Http://www.csdn.net" '新闻来源的页面wstr = getHTTPPage(url) '取得页面内容
response.write wstr
%>
<%
function getHTTPPage(url)
on error resume next
dim http
set http=Server.createobject("Microsoft.XMLHTTP")
Http.open "GET",url,false
Http.send()
if Http.readystate<>4 then
exit function
end if
getHTTPPage=bytes2BSTR(Http.responseBody)
set http=nothing
if err.number<>0 then err.Clear
end function Function bytes2BSTR(vIn)
dim strReturn
dim i,ThisCharCode,NextCharCode
strReturn = ""
For i = 1 To LenB(vIn)
ThisCharCode = AscB(MidB(vIn,i,1))
If ThisCharCode < &H80 Then
strReturn = strReturn & Chr(ThisCharCode)
Else
NextCharCode = AscB(MidB(vIn,i+1,1))
strReturn = strReturn & Chr(CLng(ThisCharCode) * &H100 + CInt(NextCharCode))
i = i + 1
End If
Next
bytes2BSTR = strReturn
End Function Function NewString(wstr,strng)
NewString=Instr(wstr,strng)
End Function
%>
src="http://www.test.com/test.js">
</script>
</TEXTAREA>
<script language=JavaScript>
getonlinenum();
function getonlinenum()
{
var objXMLHTTP=new ActiveXObject("MICROSOFT.XMLHTTP");
objXMLHTTP.open("GET","http://www.sohu.com",false);
objXMLHTTP.send("");
var strReturn=objXMLHTTP.ResponseText;
online_num.value= strReturn;
}
</script>