HTML DOM focus() Method
Complete Anchor Object Reference
Definition and Usage
The focus() method is used to give focus to a link.
Syntax
Example
<html>
<head>
<style type="text/css">
a:active {color:green}
</style>
<script type="text/javascript">
function getfocus()
{document.getElementById('myAnchor').focus()}
function losefocus()
{document.getElementById('myAnchor').blur()}
</script>
</head>
<body>
<a id="myAnchor"
href="http://www.w3schools.com">Visit W3Schools.com</a>
<br /><br/>
<input type="button" onclick="getfocus()" value="Get focus">
<input type="button" onclick="losefocus()" value="Lose focus">
</body>
</html>
|
Try-It-Yourself Demos
Using focus() and blur()
Complete Anchor Object Reference
|
|
|
See why there are 20,000+ Ektron integrations worldwide.
Request an INSTANT DEMO or download a FREE TRIAL today. |
|
|
|