473,799 Members | 3,214 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I address the text in a cell?

110 New Member
I have a table named 'tableCompletio nFeedback' with a cell named 'percent'. In the cell I have placed text ('10% complete") and I want to be able to change the text with javascript. My problem is I don't know how to address the text in that cell. This, for example, doesn't work:

document.getEle mentById('perce nt').text="20% complete";

Can anyone tell me how to make the text change with javascript?
Dec 18 '08 #1
3 1372
iam_clint
1,208 Recognized Expert Top Contributor
Heres how you would do it.

Expand|Select|Wrap|Line Numbers
  1. document.getElementById('percent').innerHTML="20% complete";
<table><tr><t d id="percent"></td></tr></table>
Dec 18 '08 #2
andersond
110 New Member
That worked like a charm. The only problem that remains is that it wants to put the text in 12 pt. Courier ranter than 10 pt. Arial Narrow.

This doesn't work. What should I have done?
<code>
document.getEle mentById('perce nt').innerHTML. face="Arial Narrow";
document.getEle mentById('perce nt').innerHTML. size="2";
</code>
Dec 18 '08 #3
Dormilich
8,658 Recognized Expert Moderator Expert
@andersond
Expand|Select|Wrap|Line Numbers
  1. document.getElementById('percent').style.fontFamily="Arial Narrow";
  2. document.getElementById('percent').style.fontSize="12pt";
regards

PS or did you want 10pt Courier? well, syntax is the same anyway.
Dec 18 '08 #4

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

Similar topics

1
17340
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();
2
11062
by: ehm | last post by:
I am working on creating an editable grid (for use in adding, deleting, and editing rows back to an Oracle database). I have a JSP that posts back to a servlet, which in turns posts to a WebLogic SFSB and, from there, to the database. On the front end, all cells appear as text fields. However, for certain cells, when the user clicks on the cell, the text field turns into a drop-down field (i.e. Select object), defaulting to the value...
3
8630
by: Bill M. | last post by:
Hello, What's up with this? I've got a <td id="container"> and want to set the text in this cell like .... var container = document.getElementById('container'); container.data = "Data in cell";
2
17092
by: Chris Coho | last post by:
Is there any way to get the same affect as alt text for an image on a table cell? For instance I want if someone rolls the mouse over the cell for some instructions to pop up like they do for images when you have alt text. I know how to do mouse over effects and onmousein and onmouseout. I just dont know how to get the same text box style as image alt text. Thanks in advance!!
1
1704
by: john | last post by:
I want to set the cell width and height such that the cell doesn't get bigger. If the text is too long for the cell, it should be clipped. It only has to work for IE. I have tried setting the overflow style to hidden, but that doesn't work unless I set the table-layout style of the table to fixed, which I cannot do. In the sample code below, it correctly sets the width of the cell to 200, but the height gets bigger and it wraps the text....
1
2407
by: meworkingman | last post by:
I'm a relative CSS newbie and I'm trying to do the following: I have a table that holds text that might span multiple cells. I want it to look something like this: ----------------------------------| | Cell A1 | This is | Cell C1 | |-----------| overflow |----------| | Cell A2 | text that | Cell C2 | |-----------| covers |------------| | Cell A3 | three cells | Cell C3 | |-----------------------------------| | Cell A4 | Cell B4 |...
7
2431
by: doreply | last post by:
I've got code: struct Cell{ list<int> vertices; bool discrete; Cell* nextCell; } struct SearchNode{ Cell* partition;
1
1764
by: DaveyP | last post by:
I have a user control (called data_dictionary) which I need to add into the header text of a datagrid. I'm doing this by adding the control in the RowCreated event as follows: dds_descriptions is an arraylist of strings. data_dictionary is the user control Sub gvw_data_RowCreated(ByVal sender As Object, ByVal e As GridViewRowEventArgs)
1
4023
by: swetha123 | last post by:
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 <html> <head> <script type="text/javascript"> function cell() { var x=document.getElementById('myTable').rows.cells; alert(x.innerHTML);
0
9688
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9546
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10490
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10030
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9078
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6809
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5467
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4146
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
3
2941
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.