php 学习记录

来源:互联网 发布:电脑怎样编程软件 编辑:程序博客网 时间:2024/05/20 13:14

cmn.php

 <script type="text/javascript">

            function validate(form)
            {
                if(form.uname.value == "")
                {
                    alert("用户名不能为空");
                    return false;
                }
                else
                {
                    if(/[^a-zA-Z0-9-_]/.test(form.uname.value))
                    {
                        alert("uname could only be a-z, A-Z, 0-9, - and _");
                        return false;
                    }
                    return ture;
                }
            }

        </script>

<table class="signup" cellpadding="2" cellspacing="5" bgcolor="#eeeeee">
            <th colspan="2" align="center">注册表单</th>
            <form action="cmn.php" method="post" onsubmit="return validate(this)">
                <tr>
                    <td>用户名</td>
                    <td><input type="text" name="uname" /></td>
                </tr>
                <tr>
                    <td>密码</td>
                    <td><input type="text" name="upwd" maxlength="20"/></td>
                </tr>
                <tr><td colspan="2" align="center"><input type="submit" value="注册" /></td></tr>
            </form>
        </table>

……………………………………



0 0
原创粉丝点击