WebFX WebBoard
Message Thread:
View All Messages
Back to WebFX
 Scrolling contents of a Textarea in mozilla, Mircho Mirev, December 10, 2003

Subject: Scrolling contents of a Textarea in mozilla From: Mircho Mirev Date: December 10, 2003

In a recent script I wrote I needed to attach to all input fields on a form intercept the keystrokes and replace keys with other keys. Almost all works now but there is a bug that bothers me

in mozilla the contents of a textarea are scrolled back to the beginning and thus if a user types at the end of the text he sees no more of it.

So I either need to find out how to scroll a textarea in mozilla to a specific place or to change the way the script works

here is the code that replaces the key with another one in mozilla
/I think the problem lays in the revriting the entire value of the input/

  var selectionStart = input.selectionStart
  var selectionEnd = input.selectionEnd
  input.value =  input.value.substring(0, selectionStart)
      + replaceString
      + input.value.substring(selectionEnd)
  setSelectionRange(input, selectionStart + replaceString.length+1, selectionStart + replaceString.length+1)
  setCaretToPos(input, selectionStart + replaceString.length )

Thanks in advance.




Reply
Name: 
Email: 
Subject: 

Enter your reply to this message below. HTML tags are not supported but words that start with http://, ftp:// or mailto: are converted to links.


View All Messages
Back to WebFX