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

How to get the element in my table's cell?

Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script language="javascript" >
  4. function smanPromptList(objInputId){//I cut my file //short to find where is wrong.
  5.           var objInputCel = document.getElementById(objInputId).rows[0].cells[1];
  6.         var objInput = objInputCel.childNodes[0]; 
  7.         document.write(objInputCel.innerText);//I tried //this wondering if it will display"apple",but it didn't.
  8. }
  9. </script>
  10. </head>
  11. <body onload="smanPromptList('tb1')" bgcolor="#ffffff">
  12. <table id="tb1" width="100%" border="0" cellspacing="3%" cellpadding="3%">
  13.   <tr>
  14.     <td id="td0" name="td0" width="300">
  15.       <form id="form0" name="form0" method="post" action="">
  16.           pv:<input type="text" name="htmlText" id="htmlText"/>
  17.         </form>
  18.     </td>
  19.     <td width="300">
  20.       apple
  21.     </td>
  22.   </tr>
  23. </table>
  24. <script language="javascript" >
  25.     document.getElementById('htmlText').value = "";
  26. </script>
  27. </body>
Nov 22 '10 #1
2 5597
Dormilich
8,658 Expert Mod 8TB
your problem is document.write(). if it is used after the page finished loading, it erases your whole document, including all styles and scripts.
Nov 22 '10 #2
Yeah,that will erases,and I thought it'll be apple displayed.But I just see undefined,that's puzzling me.
Nov 22 '10 #3

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

Similar topics

3
by: Cedric Villat | last post by:
I'm messing around the width of a table and can't see to get it right. Let me explain what I am trying to do. I have 5 cells in 1 row. The first cell I would like to be 20% of the screen space. The...
10
by: john T | last post by:
Is there anyway to vertically center a html table using css in such a way it does not alter the html table. When I tryied it just screws up.
1
by: dhunter | last post by:
I'm kind of new to CSS and hope someone knows how to fix a problem I've been fighting with for days. I'm trying to create a mouseover navbar with CSS which inserts a colored background JPG that...
2
by: autogoor | last post by:
I have a table and, in one cell of it, I have another table. How can I center the second table in the cell with css? Thanks, autogoor
6
by: chris | last post by:
is there a way by using html or javascript or anything else for that matter to detirmine the actual height or width of a table or cell for example if i only set the height to 100 and the data in...
2
by: Dot net work | last post by:
Hello. Is it possible to build up a dynamic server side table, and specify the column widths as percentages? I've tried this: Set the table width to 100%, then: FirstColumn.Width = New...
7
by: slitvinov | last post by:
I am learning Relax NG. The problem is that I cannot figure out how to make a schema for a table. In my case I would like to make a table with any name of child elements (columns) but columns...
7
by: Kamal | last post by:
Hello all, I have a very simple html table with collapsible rows and sorting capabilities. The collapsible row is hidden with css rule (display:none). When one clicks in the left of the...
3
by: rlueneberg | last post by:
I want to change the color of an "a" child element inside a table cell via javascript. Is there any way to do that? Ps: there is no id assigned to child elements. I would like to discover the child...
2
dlite922
by: dlite922 | last post by:
Before traversing my code, here's what my goal is and what this function does: I have a table of fields that dynamically grows as the user enters information. A minimum of 3 rows must always...
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
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,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.