Javascript $(函数(){…});显示ie7中的对象必需错误,并且不显示';我不能在铬上工作

Javascript $(函数(){…});显示ie7中的对象必需错误,并且不显示';我不能在铬上工作,javascript,jquery,google-chrome,internet-explorer-7,Javascript,Jquery,Google Chrome,Internet Explorer 7,我的代码可以在IE7中使用,但存在对象必需错误,在chrome和firefox中不起作用。请帮帮我。下面是我的代码 IE7浏览器从jquery函数开始显示错误,但我可以继续。但是在chrome和safari中,submit按钮和Validate()函数不起作用 <link rel="stylesheet" type="text/css" href="css/style.css" /> <script src="js/cufon-y

我的代码可以在IE7中使用,但存在对象必需错误,在chrome和firefox中不起作用。请帮帮我。下面是我的代码 IE7浏览器从jquery函数开始显示错误,但我可以继续。但是在chrome和safari中,submit按钮和Validate()函数不起作用

            <link rel="stylesheet" type="text/css" href="css/style.css" />
            <script src="js/cufon-yui.js" type="text/javascript"></script>
            <script src="js/ChunkFive_400.font.js" type="text/javascript"></script>
            <script type="text/javascript">
            Cufon.replace('h1',{ textShadow: '1px 1px #fff'});
            Cufon.replace('h2',{ textShadow: '1px 1px #fff'});
            Cufon.replace('h3',{ textShadow: '1px 1px #000'});
            Cufon.replace('.back');
            </script>
            <script type="text/javascript">
            function validate(){
            var Uname=document.getElementById("username")
            if(Uname.value==""||Uname.value==null){
            alert("Enter Your User Name")
            Uname.focus()
            return false
            }
            if(Uname.value.length<6){
            alert("Min-6 characters for your UserName")
            Uname.focus()
            return false
            }
            var pass=document.getElementById("password")
            if(pass.value==""||pass.value==null){
            alert("Enter Your Password")
            pass.focus()
            return false
            }
            if(pass.value.length<6){
            alert("Min-6 characters for your Password")
            pass.focus()
            return false
            }
            return true 
            }
            </script>
            </head>
            <body>
            <div class="wrapper">
            <h1>User Management</h1>
            <div class="content">
            <div id="form_wrapper" class="form_wrapper">
            <form class="login active" onSubmit="return validate() action="login.php" method="post">
            <h3>Login</h3>
            <div>
            <label>Username:</label>
            <input type="text" id="username"/> 
            <span class="error">enter ur email id</span>
            </div>
            <div>
            <label>Password: </label>
            <input type="password"  id="password"/><a href="forgot_password.html" rel="forgot_password" class="forgot linkform">Forgot your password?</a>
            </div>
            <div class="bottom">
            <input type="submit" value="Login"></input>
            <div class="clear"></div>
            </div>
            </form>
            <form class="forgot_password" onSubmit="return validate() action="forgotpassword.php" method="post">
            <h3>Forgot Password</h3>
            <div>
            <label>Username</label>
            <input type="text" />
            <span class="error">enter ur email id</span>
            </div>
            <div class="bottom">
            <input type="submit" value="Send reminder"></input>
            <a href="index.php" rel="login" class="linkform">Suddenly remebered? Log in here</a>
            <div class="clear"></div>
            </div>
            </form>
            </div>
            <div class="clear"></div>
            </div>

            </div>


            <!-- The JavaScript -->
            <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
            <script type="text/javascript">
            $(function() {
            //the form wrapper (includes all forms)
            var $form_wrapper   = $('#form_wrapper'),
            //the current form is the one with class active
            $currentForm    = $form_wrapper.children('form.active'),
            //the change form links
            $linkform       = $form_wrapper.find('.linkform');

            //get width and height of each form and store them for later                        
            $form_wrapper.children('form').each(function(i){
            var $theForm    = $(this);
            //solve the inline display none problem when using fadeIn fadeOut
            if(!$theForm.hasClass('active'))
            $theForm.hide();
            $theForm.data({
            width   : $theForm.width(),
            height  : $theForm.height()
            });
            });

            //set width and height of wrapper (same of current form)
            setWrapperWidth();

            /*
            clicking a link (change form event) in the form
            makes the current form hide.
            The wrapper animates its width and height to the 
            width and height of the new current form.
            After the animation, the new form is shown
            */
            $linkform.bind('click',function(e){
            var $link   = $(this);
            var target  = $link.attr('rel');
            $currentForm.fadeOut(400,function(){
            //remove class active from current form
            $currentForm.removeClass('active');
            //new current form
            $currentForm= $form_wrapper.children('form.'+target);
            //animate the wrapper
            $form_wrapper.stop()
            .animate({
            width   : $currentForm.data('width') + 'px',
            height  : $currentForm.data('height') + 'px'
            },500,function(){
            //new form gets class active
            $currentForm.addClass('active');
            //show the new form
            $currentForm.fadeIn(400);
            });
            });
            e.preventDefault();
            });

            function setWrapperWidth(){
            $form_wrapper.css({
            width   : $currentForm.data('width') + 'px',
            height  : $currentForm.data('height') + 'px'
            });
            }


            $form_wrapper.find('input[type="submit"]')
            .click(function(e){
            e.preventDefault();
            }); 
            });
            </script>
            </body>

Cufon.replace('h1',{textShadow:'1px 1px#fff'});
Cufon.replace('h2',{textShadow:'1px 1px#fff'});
Cufon.replace('h3',{textShadow:'1px 1px#000'});
Cufon.replace(“.back”);
函数验证(){
var Uname=document.getElementById(“用户名”)
if(Uname.value==“”| | Uname.value==null){
警报(“输入您的用户名”)
Uname.focus()
返回错误
}
如果(Uname.value.length
忘记密码
用户名
输入您的电子邮件id
$(函数(){
//表单包装器(包括所有表单)
var$form_wrapper=$(“#form_wrapper”),
//当前窗体是类处于活动状态的窗体
$currentForm=$form_wrapper.children('form.active'),
//更改表单链接
$linkform=$form_wrapper.find('.linkform');
//获取每个表单的宽度和高度,并将其存储以备将来使用
$form_wrapper.children('form')。每个(函数(i){
var$theForm=$(此);
//解决使用淡入淡出时的内联显示无问题
if(!$theForm.hasClass('active'))
$theForm.hide();
$theForm.data({
宽度:$theForm.width(),
高度:$theForm.height()
});
});
//设置包装的宽度和高度(与当前表单相同)
setWrapperWidth();
/*
单击表单中的链接(更改表单事件)
使当前窗体隐藏。
包装器将其宽度和高度设置为动画
新当前窗体的宽度和高度。
动画完成后,将显示新窗体
*/
$linkform.bind('click',函数(e){
var$link=$(此);
var target=$link.attr('rel');
$currentForm.fadeOut(400,函数(){
//从当前窗体中删除活动类
$currentForm.removeClass('active');
//新的当前形式
$currentForm=$form_wrapper.children('form.'+target');
//设置包装器的动画
$form_wrapper.stop()
.制作动画({
宽度:$currentForm.data('width')+'px',
高度:$currentForm.data('height')+'px'
},500,函数(){
//新窗体使类处于活动状态
$currentForm.addClass('active');
//显示新表单
$currentForm.fadeIn(400);
});
});
e、 预防默认值();
});
函数setWrapperWidth(){
$form_wrapper.css({
宽度:$currentForm.data('width')+'px',
高度:$currentForm.data('height')+'px'
});
}
$form_wrapper.find('input[type=“submit”]”)
。单击(功能(e){
e、 预防默认值();
}); 
});

您提交的for类缺少结束双引号

 <form class="login active" onSubmit="return validate()**"** action="login.php" method="post">


这将解决您的问题并触发事件。

使用分号!文本框的值不能为null,检查无效。最后,您不缩进代码吗?这将有助于查找错误。还原更改了原始帖子中某个句子的含义。这是一个小错误……我已更正,但这里再次显示错误在$function as object required错误上表现平淡。但它在ie7本地系统中工作,并在intranet服务器的所有浏览器上显示错误。感谢您回复$form_wrapper.find('input[type=“submit”]”)。单击(函数(e){e.preventDefault();});上述功能将被删除,以使其他脚本工作……现在工作正常