是不能跨域名调用
你可以试着用XMLHTTP解决这个问题
你可以试着用XMLHTTP解决这个问题
解决方案 »
- 分享关于定位输入框焦点位置的代码
- 如何显示数据库中的《时分》问题??
- 求个脚本,将select的text传送到焦点的文本框
- 梅花雪--能不能给一个从数据库使用TREEVIEW的例子啊。
- 在firefox里用js怎么读取到xml的某一节点??
- 如何用JavaScript获取客户端 硬件信息
- 请问为什么按键是图片的按键设置“disabled”为“true”会提示错误?多谢
- htc小问题(大问题)请教!
- 好书下载!
- 很简单的问题:在表单上有n个复选框,通过一个按纽,我想获取那些复选框被选中,并返回它们的name数组!
- 请问 单击是 onclick 那么 单击右键呢 ,还有双击
- 怎样通过一个input的对象获取该对象的焦点
把download.htm随便改成http://www.csdn.net就不行了
XMLHTTP该怎么用?
<HTML XMLNS:IE><SCRIPT>
function onDownloadDone(s) { alert (s); }
</SCRIPT><IE:Download ID="oDownload" STYLE="behavior:url(#default#download)" />
<P>Click <A HREF="javascript:oDownload.startDownload('download.htm',
onDownloadDone)">here</A> to begin downloading this page.
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="vbscript">
Function bytes2BSTR(vIn) Dim strReturn,i,ThisCharCode,innerCode,Hight8,Low8,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
</script>
<script language="JavaScript">
function getXML(URL) {
var xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
xmlhttp.Open("GET",URL, false);
try {
xmlhttp.Send();
var result = xmlhttp.status;
}
catch(e) {
return(false);
}
if(result==200) {
return(bytes2BSTR(xmlhttp.responseBody));
}
var xmlhttp = null;
}
function update()
{
//alert("页面开始更新");
document.body.innerHTML = getXML('http://news.sohu.com/59/31/subject207263159.shtml');
}
setInterval("update()",1000)
</script>
</head>
<body>
</body>
</html>