button和submit有什么区别?

type=button      就单纯是按钮功能  

type=submit      是发送表单

但是对于从事WEB UI的人应该要注意到,使用submit来提高页面易用性:

使用submit后,页面支持键盘enter键操作,而很多WEB软件设计师,可能没有注意到submit统一.

用button后往往页面不支持enter键了。所以需要支持enter键,必须要设置个submit,默认enter键对页面第一个submit进行操作。

==========================

<input type="submit" name="b1" value="提交"     onClick="bt_submit_onclick()">

执行完onClick,转到actionsubmit:提交按钮,点击之后直接将数据提交的服务器端,不会对鼠标的mousepressed等操作进行处理,也不触发脚本。。。

button:简单的按钮,有按钮的一些事务处理,有脚本就通过脚本将参数传过去

可以自动提交不需要onClick。所以说onclick这里可以不要。<input type="button" name="b1" value="提交"     onClick="bt_submit_onclick()">

执行完onClick,跳转文件在 js文件里控制。提交需要onClick。

比如:

1,onclick="form1.action='a.jsp';form1.submit();"     这样就实现了submit的功能了。

2,<form    name="form1"    method="post"    action="http://www.sina.com.cn">  

       <input    type="button"    name="Button"    value="Button"    onClick="submit()">  

   </form>

3,<input    type="button"    name="Button"    value="Button"    onClick="javascript:windows.location.href="你的url"">

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-10-03
  • 2021-08-23
  • 2021-08-26
  • 2021-09-07
猜你喜欢
  • 2022-01-07
  • 2022-12-23
  • 2021-09-19
  • 2022-01-30
  • 2021-12-02
  • 2022-12-23
相关资源
相似解决方案