Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. Disable DblClick

Disable DblClick

Scheduled Pinned Locked Moved Web Development
htmlquestion
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • U Offline
    U Offline
    User 616616
    wrote on last edited by
    #1

    I have a table in html file and table has few columns and rows. There is a text in each cell. When user double clicks it, it selects the text. I want to disable that function. I created my own DblClick function, but I was unable to stop double click and it select the text. My function is something likes this. function OnDblClick() { return; } And sometimes I want to fire ondblclick event to select the text. var CurrentCell = document.getElementById(id); CurrentCell.fireEvent("ondblclick"); It also does not work. Any clues? Thanks in advance. Agha Khan

    Z L 2 Replies Last reply
    0
    • U User 616616

      I have a table in html file and table has few columns and rows. There is a text in each cell. When user double clicks it, it selects the text. I want to disable that function. I created my own DblClick function, but I was unable to stop double click and it select the text. My function is something likes this. function OnDblClick() { return; } And sometimes I want to fire ondblclick event to select the text. var CurrentCell = document.getElementById(id); CurrentCell.fireEvent("ondblclick"); It also does not work. Any clues? Thanks in advance. Agha Khan

      Z Offline
      Z Offline
      ZoogieZork
      wrote on last edited by
      #2

      Just curious, but why do you want to disable selecting on double-click? - Mike

      U 1 Reply Last reply
      0
      • Z ZoogieZork

        Just curious, but why do you want to disable selecting on double-click? - Mike

        U Offline
        U Offline
        User 616616
        wrote on last edited by
        #3

        Well I have written a calendar in JavaScript, which has 2 combo boxes (for month and year) along with the table displaying the month. As you understand there is a function Onreadystatechange in script which allows you making changes at the start of web page. where I change the color of today’s date. Double click makes the date ugly. There is another solution that I could change color by firing with fireEvent function. That is also not working. I do not know why? function OnLoadDate() { var now = new Date(); var today = now.getDate(); var month = now.getMonth(); var year = now.getFullYear(); var StartOfMonth= StartDayOfMonth(year,month); var ObjectID = StartOfMonth + today - 1; var Row = Math.floor(ObjectID / 7); var Col = ObjectID % 7; Laplink.CalYear.options[year - 1995].selected = true; Laplink.Months.options[month].selected = true; WriteMonth(year,month,today); Laplink.all.CalendarID.rows[Row].cells[Col].fireEvent("ondblclick"); } Agha</x-turndown>

        1 Reply Last reply
        0
        • U User 616616

          I have a table in html file and table has few columns and rows. There is a text in each cell. When user double clicks it, it selects the text. I want to disable that function. I created my own DblClick function, but I was unable to stop double click and it select the text. My function is something likes this. function OnDblClick() { return; } And sometimes I want to fire ondblclick event to select the text. var CurrentCell = document.getElementById(id); CurrentCell.fireEvent("ondblclick"); It also does not work. Any clues? Thanks in advance. Agha Khan

          L Offline
          L Offline
          l a u r e n
          wrote on last edited by
          #4

          ummmmm is this javascript in the html page ur talking about? if so try returning false


          "there is no spoon"
          biz stuff   about me

          U 1 Reply Last reply
          0
          • L l a u r e n

            ummmmm is this javascript in the html page ur talking about? if so try returning false


            "there is no spoon"
            biz stuff   about me

            U Offline
            U Offline
            User 616616
            wrote on last edited by
            #5

            It is true that I am talking about javascript in the html page. Perhaps you have noticed the system process the default implementation first and then returns control to your custom functions. Take this example function OnDblClick() { alert("Hello"); return false; } Before displaying the Hello it already selected the text. So returning false or true has no effect. There must be another way. Still I do not know. Thank you very much for your reply.

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups