php+js+html+ajax獲取頁面數(shù)據(jù)

login.php

水富網(wǎng)站建設(shè)公司創(chuàng)新互聯(lián),水富網(wǎng)站設(shè)計制作,有大型網(wǎng)站制作公司豐富經(jīng)驗。已為水富成百上千家提供企業(yè)網(wǎng)站建設(shè)服務(wù)。企業(yè)網(wǎng)站搭建\成都外貿(mào)網(wǎng)站制作要多少錢,請找那個售后服務(wù)好的水富做網(wǎng)站的公司定做!

<!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;

           //創(chuàng)建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){

                       //發(fā)送到服務(wù)器之后返回的消息

                       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'];

   }

?>

網(wǎng)站標(biāo)題:php+js+html+ajax獲取頁面數(shù)據(jù)
轉(zhuǎn)載注明:http://muchs.cn/article6/johjig.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供手機(jī)網(wǎng)站建設(shè)、做網(wǎng)站、定制網(wǎng)站、外貿(mào)網(wǎng)站建設(shè)、電子商務(wù)、網(wǎng)站策劃

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

成都seo排名網(wǎng)站優(yōu)化