热门文章 | 热门软件| 热门源码 | 热门电影 | 知识库 | 联系我们
软件 源码 教程 影视 健康 招聘
  HTML | JavaScript | ASP | PHP | JSP | NET | VB | VC | VF | Windows | Linux | Mysql | Mssql | Oracle | Struts 
当前位置: 创世纪计算机资源网 -> 文章频道 ->js 
站内搜索:
小试prototype之ajax
作者:大灰狼 来源:创世纪计算机资源网 整理日期:2007-10-29

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>prototype ajax测试</title>
</head>
<script language="javascript" src="js/prototype.js"></script>
<body>
<p>
  <script>
    function getUsers()
    {
        var url = http://localhost:8080/first/getusers.jsp;
        var myAjax = new Ajax.Request(
                    url,
                    {method: get,onComplete: showResponse}
                    );

    }

    function showResponse(originalRequest)
    {
        $("result").value = originalRequest.responseText;
    }
</script>

<script>
    function getHTML()
    {
        var url2 = "http://localhost:8080/first/getuserstxt.jsp";
        var pars2 = "";

         var myAjax2 = new Ajax.Updater("htmlresult", url2, {method: "get", parameters: pars2});

    }
</script>


  <br>
  <textarea id="result" cols=60 rows=10 ></textarea>
</p>
<p>
  <label>
  <input type="submit" name="ok" id="ok" value="Submit" onclick="getUsers()"/>
  </label>
  <label>
  <input type="submit" name="gethtml" id="gethtml" value="GetHtml" onclick="getHTML()" />
  </label>
</p>
<br />
<div id="htmlresult">

</div>
</body>
</html>

相关文章