>Hi All,
>
>I have a HTML page that goes something like this:
>
>
><html>
><body>
><p>This is the initial text to be displayed</p>
></body>
></html>
>
>
>Now I wanted to change the text displayed in the paragraph to something like:
>
>"This is the modified text"
>
>after it is displayed in the browser. What is the object hierarchy to get to the text "caption". I believe it should begin with document.body but where does it end?
>
>TIA
>
>Mike
This can be dependant on the browser used, but the latest versions tend to be converging on the same techniques. Whatever browser, there are several ways of doing this. For IE6, possibly the easiest is to give the paragraph a unique ID :
<p id="para1">This is the initial text to be displayed</p>
this can then be modified with
para1.innerHTML="This is the modified text"
or following the full hierarchy
document.body.all.para1.innerHTML="This is the modified text"
The following links may be of use :
http://www.w3.org/TR/2000/WD-DOM-Level-1-20000929/This is the standard for the DOM, which IE6 follows to a large extent, other browsers follow it to some degree too.
http://msdn.microsoft.com/library/default.asp?url=/workshop/author/dhtml/reference/dhtml_reference_entry.aspThis is the IE specific information
http://www.w3schools.com/dhtml/default.aspA comprehensive tutorial on DHTML, with lots of modifiable examples eg
http://www.w3schools.com/dhtml/tryit.asp?filename=trydhtml_dom_innertext
Len Speed