英[taɪp] 美[taɪp]

n. Type; typeface; (printed or typed) text; in... type of

vt.& vi. typing

vt. [Medicine] Determination (blood type); classifying... by type; becoming a typical example of...; [printing] casting (type, etc.)

Third person singular: types Plural: types Present participle: typing past tense: typed past participle: typed

javascript type attribute syntax

Function:Set or return the type of button.

Syntax: buttonObject.type=value

Return: submit button is the submit button (the default value for all browsers except IE ) button button is a clickable button (IE's default value) reset button is a reset button (clear form data)

Note: Always specify the type attribute for the button. The default type in IE is "button", while in other browsers (and in the W3C specification) it is "submit".

javascript type attribute example

<!DOCTYPE html>
<html>
<head>
<script>
function alertType()
{
alert(document.getElementById("myButton").type)
}
</script>
</head>
<body>

<button id="myButton" type="button" onclick="alertType()">点击这里</button>

</body>
</html>

Run instance »

Click the "Run instance" button to view the online instance