| Previous | Home | Next |
blure() Method in JavaScript
The blur() method is used to remove focus from an element.
Example:
Take a example to loss the focus of Button.
<html>
<body>
<script language="JavaScript">
function remove_focus(){
document.getElementById(
"removeButton").blur();
document.getElementById(
"removeButton").innerText =
"This button lost its focus"
;
alert(
"The button lost its focus");
}
</script>
<input id="removeButton"
type="button"
onclick="remove_focus();"
value="Input Focus"
onFocus="this.innerText='In focus.
Click me to lose focus'">
</body>
</html>
Output:
assign() Method in JavaScript
The assign() method loads a new document.
Example:
<html>
<body>
<script language="JavaScript">
function new_doc() {
location.assign("http://r4r.co.in/");
}
</script>
<input type="button" value="Load new page(R4R)" onclick="new_doc();">
</body>
</html>
Output:
| Previous | Home | Next |