HTML DOM focus() Method
Complete Textarea Object Reference
Definition and Usage
The focus() method is used to give focus to a text area.
Syntax
Example
The following example sets and removes focus from a text area:
<html>
<head>
<script type="text/javascript">
function setFocus()
{
document.getElementById('txt1').focus()
}
function loseFocus()
{
document.getElementById('txt1').blur()
}
</script>
</head>
<body>
<textarea id="txt1">Hello world....</textarea>
<br />
<input type="button" onclick="setFocus()" value="Set focus" />
<input type="button" onclick="loseFocus()" value="Lose focus" />
</body>
</html>
|
Complete Textarea 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!
|
|