if I understand the requirement this works for me
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title></title>
<script type="text/javascript">
/*<![CDATA[*/
var globalLastFocus = {
elem: null,
getState: function (opt) {
document.Show.Show0.value=vic++;
if (document.activeElement) {
this.elem = opt || document.activeElement;
}
},
setState: function () {
document.Show.Show1.value=this.elem;
if (this.elem) {
this.elem.focus();//this is causing the above error
this.elem = null;
}
}
};
/*]]>*/
</script></head>
<body>
<input type="button" name="" value="TEST" onfocus="globalLastFocus.setState();"/>
<div onmouseup="globalLastFocus.getState();" >TEST</div>
<script> vic=0; </script>
<form name=Show id=Show style="position:absolute;visibility:visible;top:700px;left:0px;" >
<input size=100 name=Show0 >
<input size=10 name=Show1 onfocus="globalLastFocus.getState();" >
<input size=10 name=Show2 >
<input size=10 name=Show3 >
<input size=10 name=Show4 >
<input size=10 name=Show5 >
<input size=10 name=Show6 >
<input size=10 name=Show7 >
<input size=10 name=Show8 >
<input size=10 name=Show9 ><br>
<textarea name=TA rows=1 cols=100 ></textarea>
</form>
</body>
</html>
Bookmarks