Cannot return from outside a function or method. 为什么会报这个错误?
下面是一部分代码
<form name="aaa" action="registing.do" method="post" onsubmit="return check();">
</body>
<Script type="text/javascript">
function check() {
if(document.aaa.password1.value != document.aaa.password2.value) {
alert("警告!密码与确认密码不一致");
return false;
}
return true;
}
</Script>
</html>
Cannot return from outside a function or method. 不能返回外部的函数或方法!!!!
目测应该和你使用的编辑器有关(编辑器自身判断问题:例如你后端是写java的编辑器默认用后端代码方式去判断验证,但是你却用的js去判断所以应该是需要设置一下;或者它是编辑器自身的bug);
不知道你是什么编辑器 你可以看看这个链接是否合适:http://blog.csdn.net/yb1108888/article/details/8258221