日期:2014-05-17  浏览次数:20722 次

MyEclipse的JSP开发中form中的onclick中的return问题
我发现eclipse中写事件时不能用return?
例如<input type='submit' value='log' onclick='return checkForm();'/>
myeclipse提示说Cannot return from outside a function or method
但是我如果直接在webapps里面改掉jsp文件,在那里使用return则文件能正常运行,说明代码没有问题,
是不是myeclipse这里有bug?
怎么解决呢?


------解决方案--------------------
最好别这么写吧

<input type='submit' value='log' onclick='checkForm();'/>

在 checkForm() 里边做跳转就可以了,我一直都这么做的