跳转页面后,浏览器地址不变!!

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title></title>
    <script>
        function createXMLHttpRequest() {
            if (window.XMLHttpRequest) {
                XMLHttpR = new XMLHttpRequest();
            } else if (window.ActiveXObject) {
                try {
                    XMLHttpR = new ActiveXObject("Msxml2.XMLHTTP");
                } catch (e) {
                    try {
                        XMLHttpR = new ActiveXObject("Microsoft.XMLHTTP");
                    } catch (e) {
                    }
                }
            }
        }
        function sendRequest(url) {
            createXMLHttpRequest();
            XMLHttpR.open("GET", url, true);
            XMLHttpR.setRequestHeader("Content-Type", "text/html;charset=gb2312");
            XMLHttpR.onreadystatechange = processResponse;
            XMLHttpR.send(null);
        }
        function processResponse() {
            if (XMLHttpR.readyState == 4 && XMLHttpR.status == 200) {
                document.write(XMLHttpR.responseText);
            }
        }
        //sendRequest("http://www.Baidu.com/");
    </script>
</head>
<body>
    <form id="form1" runat="server">
    <div>
    <a onclick="sendRequest('WebForm2.aspx')">百度</a>
    </div>
    </form>
</body>
</html>


 

 

posted @ 2019-12-07 22:40  零一の世界  阅读(58)  评论(0编辑  收藏  举报