blob: bf8332ca8b8c95dd948992138b91e6463d44f6d9 [file] [log] [blame]
<html>
<head>
<script>
var focused_elem = "{nothing focused}";
function setFocusedElem(id) {
focused_elem = id;
updateLog();
}
function clearFocus() {
focused_elem = "";
updateLog();
}
function getFocusedElement() {
return focused_elem;
}
function updateLog() {
document.getElementById("log").innerHTML = "Focused element: " + focused_elem;
}
function selectLink1() {
clearFocus();
var sel = window.getSelection();
var range = document.createRange();
range.setStartBefore(document.getElementById('link1'));
range.setEndAfter(document.getElementById('link1'));
sel.addRange(range);
return "";
}
</script>
</head>
<body>
This is
a <a id="link1" href="http://www.google.com" onfocus="setFocusedElem(this.id)" onblur="clearFocus()">link</a>
to <a id="link2" href="http://www.google.com" onfocus="setFocusedElem(this.id)" onblur="clearFocus()">Google</a>.
<br><br><br>
<div id="log"><div>
</body>
</html>