473,405 Members | 2,282 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,405 software developers and data experts.

How to change the content in the table cell

I've a situation where upon selecting a month in a drop down the value in the <td> cell should change. It is a table oriented UI where it shows values
_____________________________
| Lable: | Value1 | Value2 | Value3 |
---------------------------------------------------
Value1, value2 value3 are different values and once I select a different month only the values should change not the lable. Like Value1 changes to Value4, Value2 changes to Value5, and Value3 changes to Value6.

This should happen once they select a value from the drop down dynamically. I've the UI developed in html and validations in asp.net and backend in vb. Can anyone please help regarding this.

Let me know if you have any more questions.
May 12 '10 #1
6 3278
RamananKalirajan
608 512MB
You can achieve that easily. But in that table whether there will be only one row or more rows ? If there going to be only one rows means you can use the following code.

Expand|Select|Wrap|Line Numbers
  1. var tblObj = document.getElementById('yourTableId');
  2. tblObj.rows[0].cells[1].innerHTML='value1';
  3. tblObj.rows[0].cells[2].innerHTML='value2';
  4. tblObj.rows[0].cells[3].innerHTML='value3';
  5.  
Thanks and Regards
Ramanan Kalirajan
May 13 '10 #2
@RamananKalirajan
Thanks Ramanan for the reply, but the UI has more than 10 rows. Can I do that using ID=" " stuff?
May 13 '10 #3
RamananKalirajan
608 512MB
yes u can do it with the Id. But can you please elaborate your requirement.

Thanks and Regards
Ramanan Kalirajan
May 14 '10 #4
@RamananKalirajan
I'm for replying late Mr.Ramanan Kalirajan, Its like I've a 15 rows and 4 columns of table, for the page design and upon the selection of the drop down on top of the page, the data in the 10th row and the Column=1,2,3 (and not 'Column=0') should change its content. Like previously it has content of
______________________
| Lable: | 4 | 5 | 6 |
-----------------------------------
for the selection of Month:may Year:2010 and if user selects month and year which is higher than may 2009, it should change those static values to
_____________________
| Lable: | 4.5 | 5.65 | 6.76 |
-----------------------------------
Can we do it using an 'Id'-tag, because the behavior is written somewhere on TOP and the UI is written in the Table tag below.
May 16 '10 #5
Dormilich
8,658 Expert Mod 8TB
note: in IE, .innerHTML is read-only for tables.
May 17 '10 #6
RamananKalirajan
608 512MB
Yes u can do that... for 'tr' 1 u can give the id of the td's as 'tr1td0' for first td like wise u can have and access the td content and easily change its value

Thanks and Regards
Ramanan Kalirajan
May 19 '10 #7

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

Similar topics

2
by: Paul E Collins | last post by:
I need to 'clip' text in a table cell instead of wrapping it, such that (i) the cell keeps its specified fixed width and (ii) any text that overflows the cell should be 'clipped' (hidden or...
7
by: John A. | last post by:
Hello all! I've got a big bunch of pages using tables for layout. Eventually I'll get them set up with more modernized code, but in the meantime I'd like to slip in a little quick holiday...
2
by: Sugapablo | last post by:
Can anyone help me out with some code to change three table cells (<td>) when one is hovered over? I have a calendar grid where each day is made up of three table cells and I want all three to...
1
by: Michael | last post by:
How can I use onclick to change a table cell background color. I know I can use this.className=? to change the classname. But then I would have to put the code into every single table cell. I...
2
by: Michael Satterwhite | last post by:
I need to be able to dynamically change the contents of a table cell (e.g. the text between <td> and </td>. I've been searching the web, but haven't found the solution to this one. I know the...
4
by: HB | last post by:
So I have a table in ASP.NET <table runat="server" id="tblMyTable"> <tr> <td id="cellMyCell">word</td> </tr> </table> How do I reference the cell "cellMyCell" from the Vb.NET 1.1...
1
by: Bart Lateur | last post by:
I'm trying to put a utton at the bottom (right) of a TD cell, irrespective of what else is in there. Usually, with other HTML block elements, we're told to use position: relative on the...
2
by: JJA | last post by:
Please advise on how I can get this content (from "Choose a Map" down to the "Show Map" button) to be positioned at the top of this table cell. Please see: ...
4
by: ma | last post by:
Hello, I want to inject a piece of JavaScript inside a table cell. How can I do this? The table is statically created on master page.
2
by: Jukka K. Korpela | last post by:
Sub titulo "Re: DIV borders different in IE7 when in td" scripsit Ben C: This seems to be the heart of the matter, and I'm trying to get a real discussion started, by moving the discussion to...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.