...

View Full Version : Help! Click works but DoubleClick doesn't



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>

srk
05-25-2005, 03:51 PM
Does anybody have any suggestions?

JustABob
05-25-2005, 06:29 PM
Take this with a grain of salt as I am just getting into web programming...

Could it be that the program is trapping the single click event when you are trying to catch a double click? What happens if you try and write the code to just catch a single click? If it works try changing it to a double click event instead of a double just to make sure that the event is setup correct.

Hope it helps, and sorry I cant give you a better answer.

srk
05-25-2005, 06:58 PM
Thanks dor the response! It works just fine with click. It's just the doubleclick that's showing this error. I even tried defining just the double click with no luck.

Thank you,
srk

glenngv
05-26-2005, 05:04 AM
http://www.codingforums.com/showthread.php?t=59651

srk
05-26-2005, 03:54 PM
Thank you so much



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum