Name

getBookmark( ), moveToBookmark( ) — NN n/a IE 4 DOM n/a

Synopsis

getBookmark( )

moveToBookmark(bookmarkString)

These two methods work together as a way to temporarily save a text range specification and restore it when needed. The getBookmark( ) method returns an opaque string (containing binary data that is of no value to human users). Once that value is stored in a variable, the range can be modified as needed for the script. Some time later, the bookmarked text range can be restored with the moveToBookmark( ) method:

var rangeMark = myRange.getBookmark( )
...
myRange.moveToBookmark(rangeMark)

Returned Value

Boolean value: true if the operation is successful; false if unsuccessful.

Parameters

bookmarkString

An opaque string returned by the getBookmark( ) method.

Get Dynamic HTML: The Definitive Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.