HTML DOM focus() Method
Complete Button Object Reference
Definition and Usage
The focus() method is used to give focus to a
button.
Syntax
Example
The following example sets focus on a button:
<html>
<head>
<script type="text/javascript">
function setFocus()
{
document.getElementById('button1').focus()
}
</script>
</head>
<body>
<form>
<input type="button" id="button1" value="Button1" />
<br />
<input type="button" onclick="setFocus()"
value="Set focus to Button 1" />
</form>
</body>
</html>
|
Try-It-Yourself Demos
Set
and remove focus from a button
Complete Button Object Reference
Learn XML with <oXygen/> XML Editor - Free Trial!
|
|
oXygen helps you learn to define,
edit, validate and transform XML documents. Supported technologies include XML Schema,
DTD, Relax NG, XSLT, XPath, XQuery, CSS.
Understand in no time how XSLT and XQuery work by using the intuitive oXygen debugger!
Do you have any XML related questions? Get free answers from the oXygen
XML forum
and from the video
demonstrations.
Download a FREE 30-day trial today!
|
|