“Cannot return from outside a function or method”

原路徑:http://blog.csdn.net/qianmuxiaoqi/article/details/16950371



今天寫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()"


發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章