[Javascript] Read/write html tag contents with Netscape

Andrew Gibson andyg at ihug.co.nz
Thu Jul 31 18:10:37 CDT 2003


I suppose you could do some fancy regular expression to strip away the tag,
and so get your innerText

eg

var txt=element.innerHTML
  // get rid of tags


----- Original Message -----
From: Paul
To: javascript at LaTech.edu
Sent: Friday, August 01, 2003 11:04 AM
Subject: [Javascript] Read/write html tag contents with Netscape


I need to read & write the text contained by named html tags.

With recent Internet Explorers one can use innerText, i.e.:

<td name="Tag4">The desired text to read & write</td>
...
function ReadWriteText(argTagName){
alert(argTagName + ' contains ' + document.all.item(argTagName).innerText);
document.all.item(argTagName).innerText = "New contents";
}

How can I do this with Netscape? Is there more than one method, depending
on Netscape/Javscript version?

Thanks!
Paul





More information about the Javascript mailing list