rose0802 2017-03-02 18:04 采纳率: 0%
浏览 809

新手求问,js内容一多就运行不起来?

js中的方法任意删除一两个就能运行,那说明jquery的路径没问题,方法也没错,可是只要多写几个方法就不能运行了,是什么原因?

 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="../work/js/jquery-1.7.2.min.js"></script>
<title>无标题文档</title>
</head>

<body>
    <div style="height:300px; width:400px; border:#33F solid 5px; background:#C9C9E7; margin:100px auto" >
        <center>
            <form id="f1" action="http://localhost:8080/WEB/User?action=Register" method="post" style="margin:30px" enctype="multipart/form-data">
                <div style="float:left">
                    账户昵称:<input type="text" name="unickname" onchange="cnickname()"/>
                </div>
                <div>
                    <img src="../work/image/right.png"  class="right1"; width="17"; height="17";/>
                    <img src="../work/image/wrong.png"  class="wrong1"; width="17"; height="17";/>
                </div>
                <div style="float:left">
                    登录邮箱:<input type="text" name="uemailaddr" onchange="cemailaddr()"/>
                </div>
                <div>
                    <img src="../work/image/right.png"  class="right2"; width="17"; height="17";/>
                    <img src="../work/image/wrong.png"  class="wrong2"; width="17"; height="17";/>
                </div>
                <div style="float:left">
                    登录密码:<input type="password" name="upassword" onchange="cpassword()"/>
                </div>
                <div>
                    <img src="../work/image/right.png"  class="right3"; width="17"; height="17";/>
                    <img src="../work/image/wrong.png"  class="wrong3"; width="17"; height="17";/>
                </div>
                <div style="float:left">
                    确认密码:<input type="password" name="uconfirm" onchange="cconfirm()"/>
                </div>
                <div>
                    <img src="../work/image/right.png"  class="right4"; width="17"; height="17";/>
                    <img src="../work/image/wrong.png"  class="wrong4"; width="17"; height="17";/>
                </div>
                <div>
                    <input type="submit" value="注册" onclick="subconfirm()"/>&nbsp;&nbsp;
                    <input type="button" 
                    onclick="window.location.href='http://localhost:8080/WEB/User?action=LoginShow'" 
                    value="登录"/>
                </div>
            </form>
        </center>
    </div>
</body>
</html>
<script>
    alert("1");
    hideall();
    alert("2");
    function hideall()
    {
        $(".wrong1").hide();
        $(".right1").hide();
        $(".wrong2").hide();
        $(".right2").hide();
        $(".wrong3").hide();
        $(".right3").hide();
        $(".wrong4").hide();
        $(".right4").hide();
    }


    function cnickname(){ //校验nickname
        var nick=/^[a-zA-Z]{1}([a-zA-Z0-9]|[._]){4,19}$/;   //大小写字母开头,允许5-20字节,允许字母数字下划线
        var value=$("input[name='unickname']").val();
        if (nick.test(value) == true) {
            $(".wrong1").hide();
            $(".right1").show(); 
        }
        else{ $(".right1").hide();
            $(".wrong1").show();
        }
    };  


    function cemailaddr(){ //校验uemailaddr
        var email=/^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/; 
        var value=$("input[name='uemailaddr']").val();
        if (email.test(value) == true) {
            $(".wrong2").hide();
            $(".right2").show(); 
        }
        else{ $(".right2").hide();
            $(".wrong2").show();
        }
    };  

    function cpassword(){ //校验password
        var pwd=/^(\w){6,20}$/;   //校验密码:只能输入6-20个字母、数字、下划线 
        var value=$("input[name='upassword']").val();
        if (pwd.test(value) == true) {
            $(".wrong3").hide();
            $(".right3").show();
        }
        else{ $(".right3").hide();
            $(".wrong3").show();
        }
    };

    function cconfirm(){ //确认密码一致
        if ($("input[name='upassword']").val()==$("input[name='uconfirm']").val() ) {
            $(".wrong4").hide();
            $(".right4").show();
        }
         else{ $(".right4").hide();
            $(".wrong4").show();
        }
    };
  • 写回答

2条回答 默认 最新

  • rose0802 2017-03-02 18:33
    关注

    自己答吧,想了两天,刚才突然想到了,在java里面用文件流定义字节数组的时候把文件限制在了4k,改大了就好了。

    评论

报告相同问题?

悬赏问题

  • ¥50 永磁型步进电机PID算法
  • ¥15 sqlite 附加(attach database)加密数据库时,返回26是什么原因呢?
  • ¥88 找成都本地经验丰富懂小程序开发的技术大咖
  • ¥15 如何处理复杂数据表格的除法运算
  • ¥15 如何用stc8h1k08的片子做485数据透传的功能?(关键词-串口)
  • ¥15 有兄弟姐妹会用word插图功能制作类似citespace的图片吗?
  • ¥200 uniapp长期运行卡死问题解决
  • ¥15 latex怎么处理论文引理引用参考文献
  • ¥15 请教:如何用postman调用本地虚拟机区块链接上的合约?
  • ¥15 为什么使用javacv转封装rtsp为rtmp时出现如下问题:[h264 @ 000000004faf7500]no frame?