The replaceAdjacentText Method


The replaceAdjacentText Method

The replaceAdjacentText method is much like the insertAdjacentText method, discussed earlier in this chapter, except that this method enables you to replace text rather than insert it. You can see the support for this method in Table 6.43.

Table 6.43. The replaceAdjacentText Method

Method

NS2

NS3

NS4

NS6

IE3a

IE3b

IE4

IE5

IE5.5

IE6

replaceAdjacentText( position , text )

             

x

x

x

 

Returns: String

You pass a position argument to this method, and the new text. Here's the values the position argument can take:

  • "beforeBegin" . Replaces the text immediately before the element.

  • "afterBegin" . Replaces the text after the start of the element (but before all other content in the element).

  • "beforeEnd" . Replaces the text immediately before the end of the element (but after all other content in the element).

  • "afterEnd" . Replaces the text immediately after the end of the element.



Inside Javascript
Inside JavaScript
ISBN: 0735712859
EAN: 2147483647
Year: 2005
Pages: 492
Authors: Steve Holzner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net