HTML -- input 元素的type属性的秘密
2009-09-17 19:49
459 查看
今天在做完paypal跳转程序后,注释了一下zen cart的支付提交按钮,一个表单加一个type值为image的按钮,点击按钮提交表单,我对image的input元素不是很熟悉,通常要么是用type为submit的input元素,要么就是定义一个事件通过脚本来提交
。但是我找了半天也没发现有定义事件,没有onclick属性,也没有通过js动态绑定事件。奇怪了半天,我想会不会是在form中如果只有一个按钮时默认就是用来提交。我就把整个表单代码复制出来,在本地测试,修改ID,NAME属性,最好才知道type为image时才会自动提交。查了一下《HTML & XHTML: The Definitive Guide, 6th Edition》(我比较喜欢参考的书,基本上找什么都有),找到如下字段:
The image type of form <input> element is a special submit button made out of a picture that, when selected by the user, tells the browser to submit the form to the server. Upon submission, the browser also includes the X,Y coordinates of the mouse pointer within the image in the form's parameter list, much like the mouse-sensitive image maps we discussed in Chapter 6.
搞了半天,type为image的input元素是type为submit的一个特殊情况,还需要进一步学习。
。但是我找了半天也没发现有定义事件,没有onclick属性,也没有通过js动态绑定事件。奇怪了半天,我想会不会是在form中如果只有一个按钮时默认就是用来提交。我就把整个表单代码复制出来,在本地测试,修改ID,NAME属性,最好才知道type为image时才会自动提交。查了一下《HTML & XHTML: The Definitive Guide, 6th Edition》(我比较喜欢参考的书,基本上找什么都有),找到如下字段:
The image type of form <input> element is a special submit button made out of a picture that, when selected by the user, tells the browser to submit the form to the server. Upon submission, the browser also includes the X,Y coordinates of the mouse pointer within the image in the form's parameter list, much like the mouse-sensitive image maps we discussed in Chapter 6.
搞了半天,type为image的input元素是type为submit的一个特殊情况,还需要进一步学习。
相关文章推荐
- HTML 18.3 表单元素input的输入属性type
- HTML <input> 标签的 type 属性
- html input标签的type属性的使用
- HTML <input> 标签的 type 属性
- HTML input type=file文件选择表单元素 小结
- Html+CSS input type=file 文件类型限制属性 accept (HTML 5)
- HTML 5 服务器发送事件、Input 类型、表单元素、表单属性
- html input type text标签属性和方法事件
- html input type text标签属性和方法事件
- HTML中文件上传时使用的<input type="file">元素的样式自定义
- Html input type text标签属性和方法事件
- html中input标签type=text的只读属性readonly和autocomplete
- HTML5中的input元素的输入类型(type属性的取值)
- HTML中的input元素的属性
- HTML表单之input元素的23种type类型
- 了解HTML表单之input元素的30个元素属性
- html 的radio单选框如何实现互斥------radio只是input的type属性
- HTML <input> type 属性
- html input type text标签属性和方法事件
- HTML基础 form-input中的type属性checkbox 显示一个打钩的多选框框