Ajax registration verification


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


<script type="text/javascript">

var xmlobj;                                     // Define the XMLHttpRequest object  

function CreateXMLHttpRequest()


{//Mozilla Browser
    xmlobj=new XMLHttpRequest();
    {// Set the MIME type
else if(window.ActiveXObject)
{//IE Browser
    xmlobj=new ActiveXObject("Msxml2.XMLHttp");
     xmlobj=new ActiveXobject("Microsoft.XMLHttp");


function senddata()                             // The main function  


    CreateXMLHttpRequest();                     // Create object  

    var showurl = "include/if_user_exists.php?username=" + document.getElementById ("username").value;                                    // Construct the URL  

    xmlobj.open("GET", showurl, true);          // Call validate  .php

    xmlobj.onreadystatechange = callback;    // Determine the URL call status values and processes  

    xmlobj.send(null);                          // Set not to send any data to the server  


function callback()                          // Used to handle State functions  


    if(xmlobj.readyState == 4 && xmlobj.status == 200)                                                                      // If the URL is successful access, then the output page  

document.getElementById("msg").innerHTML=xmlobj.responseText ;




<p><form action="#">

 User name:  <input type="text">




  header('Content-type: text/html;charset=GBK');
$conn = mysql_connect("localhost", "alang", "lingting");
$user = $_GET["username"];
$querySQL = "SELECT * FROM users WHERE name = '".$user."'";
mysql_select_db("phptest", $conn);
$rs = mysql_query($querySQL, $conn);
$rs_cnt = mysql_num_rows($rs);
 echo "<font color=RED> The user name is already in use  </font>";
else if($rs_cnt==0)
    echo "<font color=GREEN> The user name is not being used  </font>";
    echo "<font color=RED> Username authentication program error  </font>";
分类:AJAX 时间:2009-09-07 人气:642
blog comments powered by Disqus


  • DIV input and text vertically in the center to solve the problem 2011-01-11

    <div> <ul> <li><label><input type="checkbox"> Baidu </label></li> <li><label><input type="checkbox" /> The Google search engine </label></li> <li><label&g

  • HTML教程:INPUT type=text元素 | input type=text对象 2014-09-30

    INPUT type=text元素 | input type=text 创建一个单行的文本输入控件. 成员表 下面的表格列出了 input type=text 对象引出的成员.请单击左侧的标签来选择你想要查看的成员类型. 标签属性/属性 标签属性 属性 描述 ACCESSKEY accessKey 设置或获取对象的快捷键. ATOMICSELECTION 指定 元素 及其内容是否可以一不可见单位统一选择. AUTOCOMPLETE autocomplete 设置或获取对象的自动完成状态. BEG

  • js 实现 input type="file" 文件上传示例代码 2015-04-18

    在开发中,文件上传必不可少但是它长得又丑.浏览的字样不能换,一般会让其隐藏点其他的标签(图片等)来时实现选择文件上传功能 在开发中,文件上传必不可少,<input type="file" /> 是常用的上传标签,但是它长得又丑.浏览的字样不能换,我们一般会用让,<input type="file" />隐藏,点其他的标签(图片等)来时实现选择文件上传功能. 看代码: <!DOCTYPE html> <html xmlns=&

  • input type = submit or button type = submit 2008-05-16

    http://www.sitepoint.com/forums/showthread.php?t=598656 AutisticCuckoo wrote An <input> button's text is specified in its value attribute, which means it can only be a simple text string. If that's all you need, using an <input> is the way to

  • ajax中指定innerHTML时如何应用其中的SCRIPT的研究 2014-04-04

    其实这篇文章与ajax无关,但因为是ajax项目中遇到的问题.所以.... innerHTML赋值操作时,其中的script并不会被运行,可以使用正则表达式提取script,然后eval(script); 示例代码 <html> <head> <script type="text/javascript"> <!-- function load1(){ var Content= document.getElementById("Cont

  • Dynamically change the input type tag attributes (such as the password to text) 2010-12-25

    <HTML> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <script> function removeSubmitFocus () { document.all ('pass'). outerHTML = "<input type = text name ='" + document

  • 如何用正则取input type="text"中的value 2014-02-04

    1.如何通过正则取input type="text"中的value呢? 2.如何过滤掉input type="checkbox"的标签? 这样只能达到正则取input type="text"中的value可是不能过滤掉input type="checkbox"的标签! alert [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行] alert [Ctrl+A 全选 注:如需引入外部Js需刷新才能执行] 解决: aler

  • input type description 2010-11-19

    Form Input in the form that an input object, its type and with different sub-Type text input box, the password input box, radio / check box, and submit / reset buttons, the following introduced one by one. 1, type = text Input type is text, this is t

  • Refresh the page to retain the value of input type 2009-06-13

    Transfer from: http://unbounder.javaeye.com/blog/459183 In general, the page refreshes without the need to retain the value of input type are more, but there are exceptions, for example, I it was a case of the need to retain the value of input type .

  • input type = file against the user to manually enter 2010-07-31

    1. Replace the law Using hidden <input type="file"/> control, then a read-only text box and a button to simulate <input type="file"/> function. <input type="file" name="file" onpropertychange="fi

iOS 开发

Android 开发

Python 开发



PHP 开发

Ruby 开发






Javascript 开发

.NET 开发



Copyright (C) codeweblog.com, All Rights Reserved.

CodeWeblog.com 版权所有 闽ICP备15018612号

processed in 0.036 (s). 13 q(s)