Results 1 to 2 of 2

Thread: Focusing on most recent input to text area

  1. #1
    Join Date
    Feb 2010
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Focusing on most recent input to text area

    Hello there I was wondering if there is a way to focus on the most recent input to a text area (say after 50 inputs) without having to manually scroll down??

    Code:
    function console(msg){
         document.console1.input.value = document.console1.input.value+=msg
         document.console1.input.value.focus()
    		}
    ~read that focus() should do it . . . but it doesn't

    Thanks!

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    I'm not clear if any of that will do anything. But this part:

    Code:
    document.console1.input.value.focus()
    should be:

    Code:
    document.console1.input.focus();
    The line above it (essentially value = value += msg) seems to want to change the value to its current value plus the value of msg. If so, you've combined two methods, either of which would work on their own:

    1. Code:
      document.console1.input.value = document.console1.input.value + msg;
    2. Code:
      document.console1.input.value += msg;


    They probably will also work like you have it, but it's overkill. The second method is generally preferred.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •