How to select the first line in textarea?

Discussion in 'Javascript' started by laziers, Jan 27, 2008.

  1. laziers

    laziers Guest

    Hi,
    Anyone how could I select the first line in the <textarea> after page
    load?
    I have done after clicking on the textarea, but this isn't good I must
    have after load :(

    bye
     
    laziers, Jan 27, 2008
    #1
    1. Advertising

  2. laziers wrote:
    ^^^^^^^
    Nomen est omen?

    > Anyone how could I select the first line in the <textarea> after page
    > load?
    > I have done after clicking on the textarea, but this isn't good I must
    > have after load :(


    1. <body onload="...">
    2. http://www.google.com/search?q=textarea line select


    HTH

    PointedEars
    --
    Use any version of Microsoft Frontpage to create your site.
    (This won't prevent people from viewing your source, but no one
    will want to steal it.)
    -- from <http://www.vortex-webdesign.com/help/hidesource.htm>
     
    Thomas 'PointedEars' Lahn, Jan 27, 2008
    #2
    1. Advertising

  3. laziers

    Doug Gunnoe Guest

    On Jan 27, 1:52 pm, laziers <> wrote:
    > Hi,
    > Anyone how could I select the first line in the <textarea> after page
    > load?
    > I have done after clicking on the textarea, but this isn't good I must
    > have after load :(
    >
    > bye


    How did you do it by clicking?

    Just do the same thing, except instead of onclick, do
    onload="whatEverYouWerDoingBefore()"

    But what will be in the textarea when the page loads?
     
    Doug Gunnoe, Jan 27, 2008
    #3
  4. Doug Gunnoe wrote:
    > On Jan 27, 1:52 pm, laziers <> wrote:
    >> Anyone how could I select the first line in the <textarea> after page
    >> load? I have done after clicking on the textarea, but this isn't good
    >> I must have after load :(
    >> [...]

    >
    > How did you do it by clicking?
    >
    > Just do the same thing, except instead of onclick, do
    > onload="whatEverYouWerDoingBefore()"


    Probably the OP did not mean a selection programmed by *them*.

    > But what will be in the textarea when the page loads?


    The element's text content or any string value that has been assigned
    to the `value' property of the element object in the process. RTFM.


    PointedEars
    --
    var bugRiddenCrashPronePieceOfJunk = (
    navigator.userAgent.indexOf('MSIE 5') != -1
    && navigator.userAgent.indexOf('Mac') != -1
    ) // Plone, register_function.js:16
     
    Thomas 'PointedEars' Lahn, Jan 27, 2008
    #4
  5. laziers

    laziers Guest

    laziers, Jan 27, 2008
    #5
  6. laziers wrote:
    >> 1. <body onload="...">
    >> 2.http://www.google.com/search?q=textarea line select

    >
    > ok thats fine, but I cant do this in body :(


    Why not?

    BTW, please not remove the attribution line.


    PointedEars
    --
    Anyone who slaps a 'this page is best viewed with Browser X' label on
    a Web page appears to be yearning for the bad old days, before the Web,
    when you had very little chance of reading a document written on another
    computer, another word processor, or another network. -- Tim Berners-Lee
     
    Thomas 'PointedEars' Lahn, Jan 27, 2008
    #6
  7. laziers

    Guest

    On Jan 28, 7:58 am, laziers <> wrote:
    > > 1. <body onload="...">
    > > 2.http://www.google.com/search?q=textarea line select

    >
    > ok thats fine, but I cant do this in body :(


    Do you not have control of the body element directly? If not, perhaps:

    window.onload=function()
    {
    ...
    }
     
    , Jan 27, 2008
    #7
  8. laziers

    laziers Guest

    On 27 Sty, 23:18, "" <> wrote:
    > On Jan 28, 7:58 am, laziers <> wrote:
    >
    > > > 1. <body onload="...">
    > > > 2.http://www.google.com/search?q=textarea line select

    >
    > > ok thats fine, but I cant do this in body :(

    >
    > Do you not have control of the body element directly? If not, perhaps:
    >
    > window.onload=function()
    > {
    >     ...
    >
    >


    hmm maby this will work, thx
     
    laziers, Jan 28, 2008
    #8
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Augustus
    Replies:
    1
    Views:
    371
    Ken Schaefer
    Sep 10, 2003
  2. Textarea Inside of a textarea

    , Feb 4, 2006, in forum: ASP General
    Replies:
    6
    Views:
    344
    Anthony Jones
    Feb 5, 2006
  3. Richard Schneeman
    Replies:
    16
    Views:
    514
    Daniel Bush
    Aug 27, 2008
  4. palmiere
    Replies:
    1
    Views:
    431
    Erwin Moller
    Feb 9, 2004
  5. Replies:
    1
    Views:
    334
    Bart Van der Donck
    Jul 4, 2007
Loading...

Share This Page