473,396 Members | 2,050 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

How to handle ondrag event in TD ?

4
I have a table.

Expand|Select|Wrap|Line Numbers
  1.  <table border=1> 
  2. <tr>
  3. <td onmousedown="create(this)"></td>
  4. <td onmousedown="create(this)"></td>
  5. </tr>
  6. <tr>
  7. <td onmousedown="create(this)"></td>
  8. <td onmousedown="create(this)"></td>
  9. </tr>
  10. </table>
  11. <script language="javascript">
  12. function create(obj)
  13. {
  14. if(obj.hasChildNodes()) {
  15. value = obj.firstChild.nodeValue;
  16. }
  17. var children = obj.childNodes;
  18. for(k=0; k<children.length; k++) {
  19. obj.removeChild(children.item(k));
  20. }
  21. var value = "";
  22. var x = obj.createElement("input");
  23. obj.type = "text";
  24. obj.value = value;
  25. obj.focus();
  26. }
  27. </script>
  28.  
This is my actual script. It will create a textbox in the mousedown event of <td>.

Now my question is, How can I select the four <td>s, whether in the same onmousedown event or there is any onmousedrag event? please help...

If I select any one of the <td>, its border should be highlighted.
And also If I select all the <td>s, its outer border should be highlighted.
Is it possible in javascript? Similar to MS Excel.

I hope anyone of u people reply my question.

Regards,
Suresh.
Sep 29 '05 #1
3 5567
Niheel
2,460 Expert Mod 2GB
I pasted your code into a html file and tried it in a browser. I can't get any action out of it. All that happens is a small grey box shows up.

Are you looking for a 2x2 table? When you click on one of the cells it should be highlighted. If you drag and select all of the boxes, all of them should be highlighted (much like excel)?
Nov 18 '05 #2
Ivan25
1
Hi , Suresh did u manage to find the solution
for highlight a row when on click and keep it highlighted until you let go of the
mouse.
Mar 29 '06 #3
acoder
16,027 Expert Mod 8TB
See Table highlighting on click.
Jun 12 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

15
by: Tim Clacy | last post by:
Please illuminate; what operator of class 'Event' will get matched for these two cases : Event ev1; Event ev2; // Case 1 // if (ev1) ;
10
by: David | last post by:
Is there something that I can use to prevent the a user from dragging something, an image for instance. In IE I can use the ondrag = "return false;", is there a way to achieve the same way with...
2
by: tfrancis | last post by:
Hi, I am trying to handle my mouse movements myself in my JavaScript application which is ok except for the following problem. If I happen to click on an image and then move the mouse, the...
6
by: Tom | last post by:
Hi, In the following code I have reproduced a problem in IE that is extremely annoying for my application. <html> <head> <script type="text/javascript">
6
by: Leandro Berti via DotNetMonster.com | last post by:
Hi All, I wrote a code to do serial communication with an equipament. When i use the code outside of threaded class it seens work properly, but when i put inside a class and execute a thread in...
15
by: Adam J. Schaff | last post by:
I have noticed that if a user closes a form via pressing return (either while the OK button has focus or if AcceptButton is set to OK for the form) then the "ENTER" keypress event fires ON THE...
6
by: Giggle Girl | last post by:
Hi there! I am trying to get a web app for our intranet (IE 6+ only) to have a similar behavior to MS Excel, where you can "drag" in between Column Headers to resize them. See an online demo...
13
by: Abhishek | last post by:
Hi, how do I pass the handle of a control to the win32 api mouse_event. so that it will create the click event on that application only even if there is any other window in front of it. I dont...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.