srk
05-25-2005, 12:23 AM
Hi!
I have a piece of code for which I am trying to provide keyboard only navigation. In other words, I should be able to trigger click and double click events using spacebar(without using mouse). But when I hit the spacebar twice to trigger dblclick event, Iam getting the following error:
"Object doesn't support this property or method"
Please Help!
srk
My example code looks like this:
<HTML DIR=LTR>
<HEAD>
</HEAD>
<BODY>
<TABLE BORDER=1>
<TR>
<TD onkeydown="checkKey(event)"; onClick="alert('Click event')"; ondblClick="alert('dClick event')";><a href=#>Test1-a</a></TD>
<TD><a href=#>Test2-a</a></TD>
<TD><a href=#>Test3-a</a></TD>
</TR>
<TR>
<TD><a href=#>Test1-b</a></TD>
<TD><a href=#>Test2-b</a></TD>
<TD><a href=#>Test3-b</a></TD>
</TR>
<TR>
<TD><a href=#>Test1-c</a></TD>
<TD><a href=#>Test2-c</a></TD>
<TD><a href=#>Test3-c</a></TD>
</TR>
</TABLE>
<SCRIPT>
var thisEvt = null;
var thisEl= null;
var pushed = 0;
var clickid = null;
var ie4 = (navigator.appName.indexOf("Internet Explorer") !=-1) ? true: false;
function checkKey(evt){
if (!ie4) {
thisEvt = evt ;
thisEl=thisEvt.target ;
} else { thisEvt = window.event ; thisEl=thisEvt.srcElement ; }
if(thisEvt.keyCode==32){
pushed++;
if(clickid == null){
clickid = setTimeout("checkKey",200);
}else{
if (pushed == 2){
thisEl.dblclick();
pushed=0;
}
}
}
}
</SCRIPT>
</BODY>
</HTML>
I have a piece of code for which I am trying to provide keyboard only navigation. In other words, I should be able to trigger click and double click events using spacebar(without using mouse). But when I hit the spacebar twice to trigger dblclick event, Iam getting the following error:
"Object doesn't support this property or method"
Please Help!
srk
My example code looks like this:
<HTML DIR=LTR>
<HEAD>
</HEAD>
<BODY>
<TABLE BORDER=1>
<TR>
<TD onkeydown="checkKey(event)"; onClick="alert('Click event')"; ondblClick="alert('dClick event')";><a href=#>Test1-a</a></TD>
<TD><a href=#>Test2-a</a></TD>
<TD><a href=#>Test3-a</a></TD>
</TR>
<TR>
<TD><a href=#>Test1-b</a></TD>
<TD><a href=#>Test2-b</a></TD>
<TD><a href=#>Test3-b</a></TD>
</TR>
<TR>
<TD><a href=#>Test1-c</a></TD>
<TD><a href=#>Test2-c</a></TD>
<TD><a href=#>Test3-c</a></TD>
</TR>
</TABLE>
<SCRIPT>
var thisEvt = null;
var thisEl= null;
var pushed = 0;
var clickid = null;
var ie4 = (navigator.appName.indexOf("Internet Explorer") !=-1) ? true: false;
function checkKey(evt){
if (!ie4) {
thisEvt = evt ;
thisEl=thisEvt.target ;
} else { thisEvt = window.event ; thisEl=thisEvt.srcElement ; }
if(thisEvt.keyCode==32){
pushed++;
if(clickid == null){
clickid = setTimeout("checkKey",200);
}else{
if (pushed == 2){
thisEl.dblclick();
pushed=0;
}
}
}
}
</SCRIPT>
</BODY>
</HTML>