can't return outside function or method解决方法

          今天写web项目作业时,发现jsp中“Cannot return from outside a function or method” 提示return出错,百度了一下,网上说这是myeclipse的一个bug,去掉return就好了,去掉之后果然不报错,但是之后发现onSubmit()不能阻止表单提交,再百度之,原来这个return还真不能去掉。

以下就是今天错误的解决方法
          1.jsp网页出现“Cannot return from outside a function or method” 提示return出错
window –>preferences –>myeclipse –>validation –>javascript validator for Js files 把Bulid 复选框的勾去掉,

myeclipse 重启之后便生效

       2.onSubmit(), false 仍然跳转,onSubmit=”return checkForm()” ,onsubmit属性中要写”return checkForm()”,而不仅仅是
” checkForm()”

猜你喜欢

转载自blog.csdn.net/ma_chen_qq/article/details/77949851