473,585 Members | 2,501 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Pass the Input text value in a TD cell using DOM

5 New Member
hello , I need to alert the value entered in the text box,which is in TD cell, using DOM
can any one tell how please
here is the code with out a text box which is working
Expand|Select|Wrap|Line Numbers
  1. <html> 
  2. <head> 
  3. <script type="text/javascript"> 
  4. function cell() 
  5. var x=document.getElementById('myTable').rows[0].cells; 
  6. alert(x[0].innerHTML); 
  7. </script> 
  8. </head> 
  9. <body> 
  10. <table id="myTable" border="1"> 
  11. <tr> 
  12. <td>cell 1</td> 
  13. <td>cell 2</td> 
  14. </tr> 
  15. <tr> 
  16. <td>cell 3</td> 
  17. <td>cell 4</td> 
  18. </tr> 
  19. </table> 
  20. <br /> 
  21. <input type="button" onclick="cell()" value="Alert first cell"> 
  22. </body> 
  23. </html>
here is what i need
Expand|Select|Wrap|Line Numbers
  1. <html> 
  2. <head> 
  3. <script type="text/javascript"> 
  4. function cell() 
  5. var x=document.getElementById('myTable').rows[0].cells; 
  6. alert(x[1].firstChild.Value); 
  7. </script> 
  8. </head> 
  9. <body> 
  10. <table id="myTable" border="1"> 
  11. <tr> 
  12. <td>cell 1</td> 
  13. <td><input type="text" id="txt"></td> 
  14. </tr> 
  15. <tr> 
  16. <td>cell 3</td> 
  17. <td>cell 4</td> 
  18. </tr> 
  19. </table> 
  20. <br /> 
  21. <input type="button" onclick="cell()" value="Alert first cell"> 
  22. </body> 
  23. </html>
but i can't see the output if anything wromg please tell me
thanks
Swetha
Jan 29 '09 #1
1 4007
acoder
16,027 Recognized Expert Moderator MVP
JavaScript is case-sensitive, so it should be "value", not "Value".
Jan 29 '09 #2

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

Similar topics

1
17327
by: johkar | last post by:
I have a grid. When the focus is put on a cell an input is created with the value being the cell's text. I would like to size the input to the physical width of the text. Ideas? John function editCell (cell) { if (document.getElementById) { cell.normalize();
6
2016
by: Michael Hill | last post by:
I have this code that adds a table row and within the cells I create some input elements. When I go back using javascript the functionaliuty is seeing the form element. Anyone tell why I can see them? <form name='update'> myTR=document.createElement("TR"); myTR.setAttribute("id","RESULTS4"); // create cell 1 and content...
1
2386
by: Peter Kirk | last post by:
Hi there I have a form which submits a list of data to a web-application (which then saves to a database). The list consists of four input fields per row. Eg. <field_1.1><field_2.1><field_3.1><field_4.1> <field_1.2><field_2.2><field_3.2><field_4.2> <field_1.3><field_2.3><field_3.3><field_4.3> ....
1
3853
by: John_H | last post by:
Re: ASP.NET 2.0 I would like suggestions or code examples on how to collect a variable length list of input data (item# & item quantity specifically). I thought that I could accomplish this using a GridView that has ViewState enabled, an ObjectDataSource to process the submitted list, textboxes for getting new item data and an add button. ...
2
13853
by: charles-brewster | last post by:
I'm trying to write a simple JavaScript function which will use a button to copy table cell data into a form input text box as the "value" attribute. The following is intended to test the function, but doesn't work. I'm new to this - previous JavaScript experience mostly copy & paste - could somebody please point to where I'm going wrong. ...
6
1761
by: effendi | last post by:
I have an array for of input names. Input1 , input 2 etc. Can I pass the input names in a loop like document.all.value="xxxx" The problem is document.all cannot be used in Safari/firefox, I tried using document.getElementById but my inputs do have any IDs. is there any way of accomplishing thsse.?
0
2030
by: hcuellar | last post by:
Hi. Please I need your help for this: After a database query, a table is created with a cell for each information retrieved, and for each record, two buttons, and second one have besides it an text imput field to asign this, open a mail client to send a mail to some people. All this, is made in php. In other words, user logs in, a...
5
13967
by: JohnDriver | last post by:
Hi, I am having a form which has a text box and 3 radio buttons. I am using GET method in Ajax to pass the value. I can pass the value of the textbox fine but how to pass the value of radio button? I searched a few things on Google but I find the javascript below most useful in my case but there is some problem that my code is not running: ...
1
2113
by: gbengston | last post by:
Please look at my example, I have a script that pulls the value of one cell and inserts it into an input box in another cell. My problem is that the source cell is itself an input box so when I pull the value from that source cell it gives me more than just the "value": In this example, the value in the source cell is "$773". But, my script is...
0
7908
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7836
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
1
7950
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
8212
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6606
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5710
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3835
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
2343
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1175
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.