Ajax检测用户名

<script type="text/javascript">
function checkUserName()
            {
                var oVal = document.getElementById("txtVal");
                //对URL进行编码
                var url = encodeURI("test2.aspx?username="+oVal.value+"&tmp=" + new Date().getTime());
                var fnLoadding = function()
                {
                    displayLoadding(document.getElementById("spnText"));
                }
                var fnCallBack = function(oRequest)
                {
                    document.getElementById("spnText").innerHTML = oRequest;
                }
                oHttp.Get(url, fnLoadding, fnCallBack);
            }
</script>


<table cellpadding="0" cellspacing="0" border="0">
            <tr>
                <td><input id="txtVal" type="text" value="" onblur="checkUserName()" /></td>
                <td style="text-align:left; width:200px;"><span id="spnText" style="color:#F00;"></span></td>
            </tr>
        </table>

你可能感兴趣的:(html,Ajax)