VC中如何使用异步xmlhttp呢
VC中怎么使用异步xmlhttp呢
好像下面这段js代码
<script type="text/javascript">
var xmlhttp;
function loadXMLDoc(url)
{
xmlhttp=null;
if (window.XMLHttpRequest)
{// code for all new browsers
xmlhttp=new XMLHttpRequest();
}
else if (window.ActiveXObject)
{// code for IE5 and IE6
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
if (xmlhttp!=null)
{
xmlhttp.onreadystatechange=state_Change;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}
else
{
alert("Your browser does not support XMLHTTP.");
}
}
function state_Change()
{
if (xmlhttp.readyState==4)
{// 4 = "loaded"
if (xmlhttp.status==200)
{// 200 = OK
// ...our code here...
}
else
{
alert("Problem retrieving XML data");
}
}
}
</script>
C++中如何使用xmlhttp组件的onreadystatechange函数进行异步编程呢,
还有, xmlhttp的send函数第三个参数一使用_varaint_t(true)程序就抛错误
究竟是怎么回事呢,望诸位大牛指教
------解决方案--------------------
VC 调用 JS脚本函数
http://www.codeguru.com/cpp/i-n/ieprogram/article.php/c4399/
------解决方案--------------------
不过我想补充下,其实C++调用接口后,也可以通过ExecScript方法调用Js,LZ不妨去MSDN看下
6#说的CwebPage可能会有部分多余的功能
好像下面这段js代码
<script type="text/javascript">
var xmlhttp;
function loadXMLDoc(url)
{
xmlhttp=null;
if (window.XMLHttpRequest)
{// code for all new browsers
xmlhttp=new XMLHttpRequest();
}
else if (window.ActiveXObject)
{// code for IE5 and IE6
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
if (xmlhttp!=null)
{
xmlhttp.onreadystatechange=state_Change;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}
else
{
alert("Your browser does not support XMLHTTP.");
}
}
function state_Change()
{
if (xmlhttp.readyState==4)
{// 4 = "loaded"
if (xmlhttp.status==200)
{// 200 = OK
// ...our code here...
}
else
{
alert("Problem retrieving XML data");
}
}
}
</script>
C++中如何使用xmlhttp组件的onreadystatechange函数进行异步编程呢,
还有, xmlhttp的send函数第三个参数一使用_varaint_t(true)程序就抛错误
究竟是怎么回事呢,望诸位大牛指教
------解决方案--------------------
VC 调用 JS脚本函数
http://www.codeguru.com/cpp/i-n/ieprogram/article.php/c4399/
------解决方案--------------------
不过我想补充下,其实C++调用接口后,也可以通过ExecScript方法调用Js,LZ不妨去MSDN看下
6#说的CwebPage可能会有部分多余的功能