当前位置: 首页 > 网络学院 > 客户端脚本教程 > HTML DOM > DOM Input Submit 对象
The Submit object represents a submit button in an HTML form. For each instance of an <input type="submit"> tag in an HTML form, a Submit object is created.
Submit 对象代表了HTML表单中Submit 按钮,每当HTML表单中出现<input type="submit">标签就意味着Submit对象被建立起来了
举例: Form 校验
You can access a Submit object by indexing the elements array (by number or name) of the corresponding form or by using getElementById().
你可以从表单数组的数字或是名称来访问Submit 对象,或是使用getELmentById()来访问它
IE: Internet Explorer, F: Firefox, N: Netscape, W3C: World Wide Web Consortium (Internet Standard).
Property 属性 | Description 描述 | IE | F | N | W3C |
---|---|---|---|---|---|
accept | Sets or returns a list of content types, which the server processing this form will handle correctly 设置或返回内容的类型,让服务器更准确的处理这个表单 | - | Yes | ||
accessKey | Sets or returns the keyboard key to access the submit button 设置或返回能够访问submit按钮的键盘按键。 | 4 | Yes | ||
align | Sets or returns the alignment of the submit button according to the surrounding text 设置或返回submit按钮相对周围文字的对齐方式 | - | Yes | ||
alt | Sets or returns an alternate text to display if the browser does not support submit buttons 设置或返回对于那些无法支持submit按钮浏览器的替换文字。 | - | Yes | ||
defaultValue | Sets or returns the default value of the submit button 设置或返回submit按钮的默认值 | 3 | Yes | ||
disabled | Sets or returns whether or not the submit button should be disabled 设置或返回submit按钮是否应该禁用 | 5 | 1 | Yes | |
form | Returns a reference to the submit button's parent form 返回包含submit按钮表单的参考 | 3 | 1 | 2 | Yes |
id | Sets or returns the id of the submit button (In IE 4 this property is read-only) 设置或返回submit按钮的id(在IE4中这个属性只读) | 4 | 1 | Yes | |
name | Sets or returns the name of the submit button 设置或返回submit按钮的name | 3 | 1 | 2 | Yes |
size | Sets or returns the size of the submit button 设置或返回submit按钮的大小 | 3 | Yes | ||
tabIndex | Sets or returns the tab order for the submit button 设置或返回submit按钮由tab顺序所定义的索引 | 4 | Yes | ||
type | Returns the type of the form element. For a submit object it will always be "submit" 返回表单元素类型,是submit按钮的话就会返回为"submit" | 3 | 1 | 3 | Yes |
value | Sets or returns the value of the value attribute of the submit button 设置或返回submit按钮value属性的值 | 3 | 1 | 2 | Yes |
Method 方法 | Description 描述 | IE | F | N | W3C |
---|---|---|---|---|---|
blur() | Removes focus from the submit button 取消对submit按钮的聚焦 | 4 | 1 | Yes | |
click() | Simulates a mouse-click on the submit button 模仿鼠标点击submit按钮 | 4 | 1 | 2 | Yes |
focus() | Sets focus on the submit button 设置submit按钮的聚焦 | 3 | 1 | Yes | |
select() | Selects the submit button 选中submit按钮 | 4 | 1 | No |
Syntax: object.event_name="someJavaScriptCode"
语法:对象.事件名称=“一些JS代码”
Event 事件 | Description 描述 | IE | F | N | W3C |
---|---|---|---|---|---|
onBlur | Executes some code when the submit button loses focus 当submit按钮失去聚焦的时候执行一些代码 | 4 | |||
onClick | Executes some code when the user clicks on the submit button 当用户点击了submit按钮的时候执行一些代码 | 4 | 1 | 2 | |
onFocus | Executes some code when the submit button gets focus 当submit按钮的到聚焦的时候执行一些代码 | 3 | |||
onSelectStart | Executes some code when the submit button is selected 当submit按钮被选中的时候执行一些代码 | 4 | 1 | 4 |