Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #16535
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!feeder.erje.net!news2.arglkargh.de!news.musoftware.de!wum.musoftware.de!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail |
|---|---|
| From | "Mel Smith" <med_cutout_syntel@aol.com> |
| Newsgroups | comp.lang.javascript |
| Subject | firstChild Problem |
| Date | Wed, 10 Oct 2012 11:20:53 -0600 |
| Lines | 49 |
| Message-ID | <adlp3qFhpnlU1@mid.individual.net> (permalink) |
| X-Trace | individual.net QSGfflyJnVmfOlacmB86PAf0wj5sx8cnMJAlDgKSb2LWcwPVDxOhoDEaxmQ5s/wMg8 |
| Cancel-Lock | sha1:U6DeOmQdbn6fj4lQRE4tD/rwB80= |
| X-Priority | 3 |
| X-MSMail-Priority | Normal |
| X-Newsreader | Microsoft Outlook Express 6.00.2900.5931 |
| X-RFC2646 | Format=Flowed; Original |
| X-MimeOLE | Produced By Microsoft MimeOLE V6.00.2900.6157 |
| Xref | csiph.com comp.lang.javascript:16535 |
Show key headers only | View raw
Hi:
I'm trying to set a value into a <span> element which on loading is
empty.
This causes a FF error.
If I beging with an non-empty value in the span element, there is no
problem.
But if I (in a JS function try to initialize the value in the <span>, FF
says the firstChile value is null ! (I *know* that it is (or *may*) be
empty, but wish to init it anyway.
What stupid thing am I assuming here ??
Thanks !
-- Mel Smith
***************************
myjsfunc() {
..
// I'm trying to initialize a text node with the word 'Searching'
// But when I try to, then,
// the next line results in a FireFox error: 'srchtxt.firstChild' is null
// Here is the line that results in the error:
srchtxt.firstChild.nodeValue = "Searching ...";
// Yet if I intentionally place a 'searching ...' string
// in the <span> on the original page, it works correctly, and if I then
// set the nodeValue later to "" (i.e., empty string), and re-enter my
function,
// there is no error ?
}
<body>
<div id="somediv">
<span id="srchtxt"></span>
</div>
</body>
***********************************
Back to comp.lang.javascript | Previous | Next — Next in thread | Find similar | Unroll thread
firstChild Problem "Mel Smith" <med_cutout_syntel@aol.com> - 2012-10-10 11:20 -0600
Re: firstChild Problem -- Correction "Mel Smith" <med_cutout_syntel@aol.com> - 2012-10-10 11:35 -0600
Re: firstChild Problem -- Correction "Jukka K. Korpela" <jkorpela@cs.tut.fi> - 2012-10-10 20:42 +0300
Re: firstChild Problem Denis McMahon <denismfmcmahon@gmail.com> - 2012-10-10 17:40 +0000
Re: firstChild Problem Matt McDonald <matt@fortybelow.ca> - 2012-10-10 13:56 -0400
Re: firstChild Problem "Mel Smith" <med_cutout_syntel@aol.com> - 2012-10-10 12:13 -0600
csiph-web