请始终为按钮规定 type 属性。Internet Explorer 的默认类型是 "button",而其他浏览器中(包括 W3C 规范)的默认值是 "submit"。

有时候你点按钮会刷新页面,是因为HTML没有设置button的type属性,其默认为“submit”,提交页面了,要么点击时最好写return:false,要么设置type为button

posted on 2020-06-15 17:31  Qionghuihe  阅读(305)  评论(0编辑  收藏  举报