当前位置: 代码迷 >> Java Web开发 >> 这个JS为什么报错啊,帮忙看看呀
  详细解决方案

这个JS为什么报错啊,帮忙看看呀

热度:103   发布时间:2010-05-12 11:23:52.0
这个JS为什么报错啊,帮忙看看呀
<script type="text/javascript">
    if (getCookie("username") != null) {
        $("j_username").value = getCookie("username");
        $("j_password").focus();
    } else {
        $("j_username").focus();
    }
   
    function saveUsername(theForm) {
        var expires = new Date();
        expires.setTime(expires.getTime() + 24 * 30 * 60 * 60 * 1000); // sets it for approx 30 days.
        setCookie("username",theForm.j_username.value,expires,"<c:url value="/"/>");
    }
   
    function validateForm(form) {                                                               
        return validateRequired(form);
    }
   
    function passwordHint() {
        if ($("j_username").value.length == 0) {
            alert("The <fmt:message key="label.username"/> field must be filled in to get a password hint sent to you.");
            $("j_username").focus();
        } else {
            location.href="<c:url value="/passwordHint"/>?username=" + $("j_username").value;     
        }
    }
   
    function required () {
        this.aa = new Array("j_username", "<fmt:message key="errors.required"><fmt:param><fmt:message key="label.username"/></fmt:param></fmt:message>", new Function ("varName", " return this[varName];"));
        this.ab = new Array("j_password", "<fmt:message key="errors.required"><fmt:param><fmt:message key="label.password"/></fmt:param></fmt:message>", new Function ("varName", " return this[varName];"));
    }
</script>
----------------解决方案--------------------------------------------------------
错误代码在哪一行。。

然后getCookie方法没提供

----------------解决方案--------------------------------------------------------
回复 2楼 午夜屠猪男
我刚学习,这个是login.js,是不是不用<script type="text/javascript"></script>这个标签了呀?不知道.JS文件和嵌入在HTML和JSP中的javascript有什么区别啊?
报了很多错,都不知道怎么回答,能先解答下我上面的问题吗?谢谢了啊
----------------解决方案--------------------------------------------------------
为什么都不喜欢把错误信息贴出来呢?
----------------解决方案--------------------------------------------------------
  相关解决方案