php+js+html+ajax获取页面数据

login.php

水富网站建设公司创新互联,水富网站设计制作,有大型网站制作公司丰富经验。已为水富成百上千家提供企业网站建设服务。企业网站搭建\成都外贸网站制作要多少钱,请找那个售后服务好的水富做网站的公司定做!

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html>

<head>

   <link type="text/css" href="app.css" rel="stylesheet">

   <meta name="viewport" content="width=device-width; initial-scale=1.4;  minimum-scale=1.0; maximum-scale=2.0"/>

   <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />

   <title></title>

   <script type="text/javascript" language="JavaScript">

       function login(){

           var account=document.getElementById('account');

           var password=document.getElementById('password');

           if(account.value==""){

               alert("请输入帐号");

               account.focus;

               return;

           }

           if(password.value==""){

               alert("请输入密码");

               password.focus;

               return;

           }

           var xmlHttp;

           //创建XMLHttpRequest对象

           if(window.ActiveXObject){

               xmlHttp = new ActiveXObject("Microsoft.XmlHttp");

           } else if(window.XMLHttpRequest){

               xmlHttp = new XMLHttpRequest();

           }

           xmlHttp.onreadystatechange = function(){

               if(xmlHttp.readyState==4){

                   if(xmlHttp.status==200){

                       //发送到服务器之后返回的消息

                       document.getElementById('msg').innerHTML=xmlHttp.responseText;

                   }

               }

           }

           var url="test.php";

           var queryString="account=" + account.value;

           xmlHttp.open("post",url,true);

           xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded;");

           xmlHttp.send(queryString);

       }

   </script>

</head>

<body >

<div class="appList"  >

   <table border="0" cellpadding="1" cellspacing="1" bordercolor="#AA7E7B">

       <tr>

           <td>

               帐号:

           </td>

           <td>

               <input id="account" type="text" maxlength="100" /><br/>

           </td>

       </tr>

       <tr>

           <td>

               密码

           </td>

           <td>

               <input id="password" type="password" maxlength="100" />

           </td>

       </tr>

   </table>

   <input   type="button" value="登录" onclick="login()"/>

   <div id="msg"></div>

</div>

</body>

</html>

test.php

<?php

   if(isset($_REQUEST['account'])){

       echo "get account:".$_REQUEST['account'];

   }

?>

网站标题:php+js+html+ajax获取页面数据
转载注明:https://www.cdcxhl.com/article6/johjig.html

成都网站建设公司_创新互联,为您提供手机网站建设做网站定制网站外贸网站建设电子商务网站策划

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

成都seo排名网站优化