473,508 Members | 4,628 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

ignorant question

hi

sorry new to jscript (woops! javascript) and feeling stupid, checked
the faq and google to no avail. i've got a <td> with some text in it
that i wanted to chage, so i put this in it:

<span id="value">some text</span>

But this didn't work:
document.getElementByID('value').innerText=value;

any ideas? also, where can i find a reference so if i have, say, a
<span>, i can find all the properties and methods i can apply to it?
i've checked DOM references, but couldn't find what i needed.
cheers
dave

Jul 23 '05 #1
9 2183
ma**********@hotmail.com wrote:
hi

sorry new to jscript (woops! javascript) and feeling stupid, checked
the faq and google to no avail. i've got a <td> with some text in it
that i wanted to chage, so i put this in it:

<span id="value">some text</span>

But this didn't work:
document.getElementByID('value').innerText=value;
Because you are trying to set its value to a variable named value. Also,
innerText is IE only. See below.
any ideas? also, where can i find a reference so if i have, say, a
<span>, i can find all the properties and methods i can apply to it?
i've checked DOM references, but couldn't find what i needed.


http://jibbering.com/faq/#FAQ4_15 and its DynWrite is what you are
hunting. It applies for SPAN tags as well as a DIV tag.

You could also give the TD tag an ID and DynWrite to it as well,
nullifying the need for a span inside the TD.
--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #2
ma**********@hotmail.com wrote:
sorry new to jscript (woops! javascript) and feeling stupid, checked
the faq and google to no avail. i've got a <td> with some text in it
that i wanted to chage, so i put this in it:

[snip]

You can also use DOM methods to create a new text node and replace the
text node inside the TD. There are lots of examples in this news group
of how to do it.

Cheers, Fred
Jul 23 '05 #3
interesting. well i've tried this:

<td align="center" id="timeLength">some text</td>

and in js:

document.getElementByID('timeLength').firstChild.n odeValue="some other
text";

but it spits out an error. any ideas?

cheers
dave

Jul 23 '05 #4
<ma**********@hotmail.com> wrote in message
news:10**********************@k26g2000oda.googlegr oups.com...
interesting. well i've tried this:

<td align="center" id="timeLength">some text</td>

and in js:

document.getElementByID('timeLength').firstChild.n odeValue="some other
text";

but it spits out an error. any ideas?

Yes: getElementById(...)
Jul 23 '05 #5
<ma**********@hotmail.com> wrote in message
news:10*********************@k17g2000odb.googlegro ups.com...
hi

sorry new to jscript (woops! javascript) and feeling stupid, checked
the faq and google to no avail. i've got a <td> with some text in it
that i wanted to chage, so i put this in it:

<span id="value">some text</span>

But this didn't work:
document.getElementByID('value').innerText=value;

any ideas? also, where can i find a reference so if i have, say, a
<span>, i can find all the properties and methods i can apply to it?
i've checked DOM references, but couldn't find what i needed.
cheers
dave


JavaScript is case sensitive: getElementById not getElementByID

<html>
<head>
<title>changetd.htm</title>
</head>
<body>
<table border="1">
<tr>
<td id="value">some text</span></td>
</tr>
</table>
<script type="text/javascript">
document.getElementById("value").innerText = "some other text";
</script>
</body>
</html>
Jul 23 '05 #6
LOL i was looking at your answers for a while before i finally spotted
the small "d". regarding my other question again, does anyone know
where i can find a good complete online references to DOM methods and
attributes, so i can find things like "innerText", getChildNode, etc
for myself?

cheers
dave

Jul 23 '05 #7
ma**********@hotmail.com wrote:
LOL i was looking at your answers for a while before i finally spotted
the small "d". regarding my other question again, does anyone know
where i can find a good complete online references to DOM methods and
attributes, so i can find things like "innerText", getChildNode, etc
for myself?

cheers
dave

Appart from the FAQ for this news group, you can try at Mozilla:

http://www.mozilla.org/docs/web-developer/

They have links to many useful sites (including W3C specs). The Mozilla
DOM spec is very handy, but it's focuses on Mozilla (of course):

http://www.mozilla.org/docs/dom/domref/

Wherever they say "DOM level 0", it is not part of the spec but it is
supported as legacy from older browsers.

Have fun - Fred.
Jul 23 '05 #8
<ma**********@hotmail.com> wrote in message
news:10**********************@k26g2000oda.googlegr oups.com...
LOL i was looking at your answers for a while before i finally spotted
the small "d". regarding my other question again, does anyone know
where i can find a good complete online references to DOM methods and
attributes, so i can find things like "innerText", getChildNode, etc
for myself?

cheers
dave

http://www.w3.org/TR/2000/REC-DOM-Le...Core-20001113/
Jul 23 '05 #9
perfect! thanks for the help guys.

cheers
dave

Jul 23 '05 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1399
by: Martin Feuersteiner | last post by:
Hi! This is a very basic question.. don't make fun of me please! I'm confused by all this logins, users, roles etc.. What I want to do it is to have an ASP.NET application that uses MSSQL as a...
3
1358
by: Rut | last post by:
I'm looking for a crash course in the use of xml. I am a programmer of mostly client-server type apps hitting against sql server. I don't program web related apps at all. I've taken classes in xml...
3
4997
by: Stevey | last post by:
I have the following XML file... <?xml version="1.0"?> <animals> <animal> <name>Tiger</name> <questions> <question index="0">true</question> <question index="1">true</question> </questions>
14
2556
by: Zac Hester | last post by:
I figured since a lot of us around here design sites for "customers" a lot, I'd ask a general question that might help a lot of us in the future. When dealing with clients asking for...
7
2628
by: nospam | last post by:
Ok, 3rd or is it the 4th time I have asked this question on Partial Types, so, since it seems to me that Partial Types is still in the design or development stages at Microsoft, I am going to ask...
7
1667
by: Joe Weinstein | last post by:
Hi all. Sorry for the basic question... What's the syntax for creating a procedure which simply returns a cursor for "select * from foo"? I am completely illiterate about DB2, and I'm just...
3
3058
by: Ekqvist Marko | last post by:
Hi, I have one Access database table including questions and answers. Now I need to give answer id automatically to questionID column. But I don't know how it is best (fastest) to do? table...
7
1133
by: VBCodr | last post by:
Please don't nail me if this is the wrong forum - please direct me to the right one. I have been tech lead/architect on a very big asp/com+/vb6 internal app. I am trying to convince the powers...
3
977
by: mark | last post by:
about the configuration manager's platform listbox. The choises are: ..NET and ACTIVE(.NET) What's this about? I can't find it anywhere in the online help. -- mark
0
7228
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
7393
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
7502
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
5635
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
4715
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...
0
3206
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...
0
3191
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1565
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 ...
1
769
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.