主题:vs2005,vs2008里一个很奇怪的问题
下面一段javascript代码,是将数据post给服务器端.
<script language="javascript" type="text/javascript">
var xmlHttpRequest;
function Button1_onclick()
{
var xmlDoc;
var xmlFilePath="C:/sql.xml";
if(window.ActiveXObject)// code for IE
{
xmlDoc = new ActiveXObject('Microsoft.XMLDOM');
xmlDoc.async = false;
[color=FF0000]xmlDoc.load(xmlFilePath); [/color]
}
xmlHttpRequest=new ActiveXObject("Msxml2.XMLHTTP");
xmlHttpRequest.onreadystatechange=handleStateChange;
xmlHttpRequest.open("POST", "http://localhost/test0304/default.aspx", true);
xmlHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xmlHttpRequest.send(xmlDoc);
}
function handleStateChange()
{
var test=xmlHttpRequest.readyState;
if(xmlHttpRequest.readyState==4)
{
alert(xmlHttpRequest.status);
if(xmlHttpRequest.status==200)
{
}
}
}
</script>
把这段代码放在VS2005或者VS2008里面的asp或者html里面都不能运行成功,
问题就在[color=FF0000]xmlDoc.load(xmlFilePath);[/color]
而把这段代码拿出来直接新建一个HTML文件,就能运行成功.
请问是不是要改web.config文件,或者其它,望大家指点!
<script language="javascript" type="text/javascript">
var xmlHttpRequest;
function Button1_onclick()
{
var xmlDoc;
var xmlFilePath="C:/sql.xml";
if(window.ActiveXObject)// code for IE
{
xmlDoc = new ActiveXObject('Microsoft.XMLDOM');
xmlDoc.async = false;
[color=FF0000]xmlDoc.load(xmlFilePath); [/color]
}
xmlHttpRequest=new ActiveXObject("Msxml2.XMLHTTP");
xmlHttpRequest.onreadystatechange=handleStateChange;
xmlHttpRequest.open("POST", "http://localhost/test0304/default.aspx", true);
xmlHttpRequest.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
xmlHttpRequest.send(xmlDoc);
}
function handleStateChange()
{
var test=xmlHttpRequest.readyState;
if(xmlHttpRequest.readyState==4)
{
alert(xmlHttpRequest.status);
if(xmlHttpRequest.status==200)
{
}
}
}
</script>
把这段代码放在VS2005或者VS2008里面的asp或者html里面都不能运行成功,
问题就在[color=FF0000]xmlDoc.load(xmlFilePath);[/color]
而把这段代码拿出来直接新建一个HTML文件,就能运行成功.
请问是不是要改web.config文件,或者其它,望大家指点!