Disable DblClick
-
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
-
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
Just curious, but why do you want to disable selecting on double-click? - Mike
-
Just curious, but why do you want to disable selecting on double-click? - Mike
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>
-
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
-
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.