Hi all,

I would like to restore focus in a textarea with the cursor in the
same place it was when it lost focus.
I use getbookmark() on blur and want to use movetobookmark() for
restoring the old-cursorposition.
This is what i have sofar:

HTML Code:
<html>
<head>
<script>
bookmark = '';

function do_bookmark(content)
{
bookmark = content.createTextRange().getBookmark();
document.all.bookmarkmemory.value = bookmark;
}

function restore_cursor(content)
{
content.focus();
content.createTextRange().moveToBookmark(bookmark);
}

</script>
</head>
<body>
<form name="aForm">
Bookmark: <br/>
<textarea name="bookmarkmemory" cols="80" rows="5"></textarea><br/>
<b>The textarea:</b> <br/>
<textarea name="aTextArea" onBlur="do_bookmark(this);" cols="80"
rows="10">
 This is some sample text. This is some sample text. This is some
sample text. This is some sample text. This is some sample text. This
is some sample text.  </textarea>
<br/>
<input type="button" value="restore focus at bookmarked position"
onclick="restore_cursor(this.form.aTextArea);">
</form>
</body>
</html>
Onblur the bookmark is set (this is made visible in the first
textareabox).
By pushing the button i would like to restore the focus in the
textarea at the bookmarked position.

Does anyone have an idea how i can do this?

Greetz, Jpp