Reset valueProperty

Reset 对象参考手册Reset Object

Definition and Usage

The value property can set or return the value of the reset button's value attribute.

The value property specifies the text displayed on the reset button.

Syntax

Set the value property:

resetObject.value="value"

Return the value property:

resetObject.value


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the value property


Example

Example

The following example can alert the text displayed on the reset button:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Example Tutorial (example.com)</title>
<script>
function displayResult(){
    var x=document.getElementById("reset1").value;
    alert(x);
}
</script>
</head>
<body>

<form>
Email: <input type="text" id="email">
<input type="reset" id="reset1" value="Reset form">
</form>
<button type="button" onclick="displayResult()">Show the value of the reset button</button>

</body>
</html>

Try it Yourself »


Reset 对象参考手册Reset Object Other Extensions