SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    Dec 2002
    Location
    Asker, Norway
    Posts
    125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    onclick & ondblclick

    I'm trying to use the onclick & ondblclick events to lunch to different pages, but when I dblclick both pages appeares. And i'm very not-good with javascript.


    Code:
    	function klikk()
    	{
    		window.open("http://www.vg.no", target="_blank");
    		event.returnValue=false;
    	}
    	
    	function dblklikk()
    	{
    		window.open("http://www.dagbladet.no", target="_blank");
    		event.returnValue=false;
    	}
    
    <body onClick="klikk()" ondblClick="dblklikk()">
    Last edited by claus erik; Jan 12, 2003 at 12:33.

  2. #2
    ♪♪ ♪ ♪ ♪ ♪♪ ♪ ♪♪ Markdidj's Avatar
    Join Date
    Sep 2002
    Location
    Bournemouth, South UK
    Posts
    1,551
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    click to dblclick....

    Thats because you have to go through a click to get to the double click. Maybe putting a setTimeout on the click, so it will ignore the dble click might do it. I haven't tried yet!!!

    hope it helps
    LiveScript: Putting the "Live" Back into JavaScript
    if live output_as_javascript else output_as_html end if

  3. #3
    SitePoint Zealot
    Join Date
    Dec 2002
    Location
    Asker, Norway
    Posts
    125
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    what i want is one action to happen when i click. Thats okey.
    But I want's another action to happen if I doubleclick, and when I doubleclick I do not want the click action to happen.
    Something like

    Onclick()
    { window.open(url)
    }

    Ondblclick()
    { If not click has happend
    window.open(url)
    End
    }

  4. #4
    ********* Callithumpian silver trophy freakysid's Avatar
    Join Date
    Jun 2000
    Location
    Sydney, Australia
    Posts
    3,798
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This article looks like it has a solution:

    http://www.chipchapin.com/WebTools/J...ample3-01.html


Bookmarks

Posting Permissions

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