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" Newsgroups: comp.lang.javascript Subject: firstChild Problem Date: Wed, 10 Oct 2012 11:20:53 -0600 Lines: 49 Message-ID: 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 Hi: I'm trying to set a value into a 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 , 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 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 ? }
***********************************