今天在做一个删除功能,当点击删除按钮时,想要给用户一个提示,所以在jsp页面中就想通过 onclick="return confirm('确定要删除吗?')” 来实现,但是confirm()方法提示:Cannot return from outside a function or method。解决这个问题的方法很简单,总结一下有两种:

方法一

   window --》preferences --> myeclipse --> validation -->javascript validator for Js files 把Build复选框的选项去掉就好了。

Cannot return from outside a function or method.

方法二

   在当前项目右击,找到myeclipse -->Exclude Form Validation单击,可以看到出现了“”,这时就不报错了。

Cannot return from outside a function or method.

方法三

  去掉return关键字。

相关文章:

  • 2022-12-23
  • 2021-08-25
  • 2021-12-19
  • 2021-09-21
  • 2021-12-22
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-09-09
  • 2022-12-23
  • 2021-07-25
  • 2021-09-09
相关资源
相似解决方案