|
July 5, 2001 Replacing DOM Substrings Tips: February 2001
Yehuda Shiran, Ph.D.
|
|
Internet Explorer 6 offers greater
functionality than Internet Explorer 5.5, as far as text manipulation is concerned.
The replaceData()
method is one example. Operating on text nodes, it replaces a substring from the
text node data. You can specify the offset of the substring and its length, as
well as the new string to insert. Here is the syntax:
where:
Let's create a text node at the
and then let's replace a substring that starts at offset 15 and of length 16, with Here is the definition of this button:
And here is the definition of the event handler above:
People who read this tip also read these tips: Look for similar tips by subject: |