2月21号工作


    [1]需要跳出警告框
    [2]警告框跳出的是simpleResponse.xml的内容
    [3]无法找到错误


<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml...
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
<!--定义变量-->
var xmlHttp;
<!--创建函数-->
function createXMLHttpRequest()
{
    <!--if判断浏览器是否支持ActiveX控件,如果浏览器支持ActiveX控件可以利用-->
    if(window.ActiveXObject)
    {
        <!--实例化对象将ActiveXObject("Microsoft.XMLHTTP")放进实例化后的xmlHttp里面-->
        xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
    }
    <!--否则判断接收 的数据,从SERVLET反应回来的东西-->
    else if(window.XMLHttpRequest)
    {
        <!--实例化对象把XMLHttpRequest()放进实例化后的xmlHttp里面-->
        xmlHttp = new XMLHttpRequest();
    }
}
<!--创建函数-->
function startRequest()
{
    <!--createXMLHttpRequest 创建一个XMLHttpRequest-->
    createXMLHttpRequest();
    <!--xmlHttp 调用 onreadystatechange 属性储存了回调函数的指针 handleStateChange 取得头部数字-->
    xmlHttp.onreadystatechange = handleStateChange;
    <!--xmlHttp 发送请求给simpleResponse.xml文件-->
    xmlHttp.open("GET","simpleResponse.xml",true);
    <!--开始发送-->
    xmlHttp.send(null);
}
<!--创建函数-->
function handleStateChange()
{
    <!--判断xmlHttp的返回值类型 等于 4-->
    if(xmlHttp.readyState == 4)
    {
        <!--判断xmlHttp返回的数值 等于 200-->
        if(xmlHttp.state == 200)
        {
        <!--警告框-->
            alert("The server replied with: " + xmlHttp.responseText);
        }
    }
}
</script>
</head>

<body>
<form action="#">
<input type="button" value="Start Basic Asynchronous Request" onclick="startRequest()" />
</form>
</body>
</html>


今天的英语

    [1]apple /aepl/ 音标/p/前读音/o/后读音 苹果
    [2]bird/b;d/ 音标/b/ 鸟
    [3]rat/raet/若 音标/r/ 老鼠

猜你喜欢

转载自xjwolaile.iteye.com/blog/1810855
今日推荐