Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    srk
    srk is offline
    New Coder
    Join Date
    May 2005
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help! Click works but DoubleClick doesn't

    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>

  • #2
    srk
    srk is offline
    New Coder
    Join Date
    May 2005
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Does anybody have any suggestions?

  • #3
    New to the CF scene
    Join Date
    May 2005
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #4
    srk
    srk is offline
    New Coder
    Join Date
    May 2005
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #5
    Supreme Master coder! glenngv's Avatar
    Join Date
    Jun 2002
    Location
    Philippines
    Posts
    11,042
    Thanks
    0
    Thanked 251 Times in 247 Posts

  • #6
    srk
    srk is offline
    New Coder
    Join Date
    May 2005
    Posts
    15
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Thank you so much


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •