Putting a cusor in normal text

Discussion in 'Javascript' started by dedejavu@hotmail.com, Jul 26, 2005.

  1. Guest

    Hi all you JS experts,
    Is there any way to put a blinking ibeam cursor in middle of td text -
    the same way it would blink if I clicked in the middle of the text in a
    text input? To further explain, I can highlight any text on an HTML
    page by dragging, but if I just click I get no ibeam cursor (obviously
    because I am not supposed to be able to edit). Is there anyway to get
    one to sit there and blink where-ever I click on the page.
    Thanks for your help
    Pachydermitis
     
    , Jul 26, 2005
    #1
    1. Advertising

  2. VK Guest

    wrote:
    > Hi all you JS experts,
    > Is there any way to put a blinking ibeam cursor in middle of td text -
    > the same way it would blink if I clicked in the middle of the text in a
    > text input? To further explain, I can highlight any text on an HTML
    > page by dragging, but if I just click I get no ibeam cursor (obviously
    > because I am not supposed to be able to edit). Is there anyway to get
    > one to sit there and blink where-ever I click on the page.
    > Thanks for your help
    > Pachydermitis


    You can set it very easy for IE by using contenteditable attribute
    (note that you cannot set table cell itself to contenteditable, so you
    need a div wrapper).

    <html>
    <head>
    <title>contentEditable</title>
    <meta http-equiv="Content-Type" content="text/html;
    charset=iso-8859-1">
    <style type="text/css">
    body { background-color: #FFFFFF}
    td div { font: 10pt Verdana, Helvetica, sans-serif; height: auto;
    width: 100%}
    </style>
    </head>
    <body>
    <table width="75%" cellpadding="10" cellspacing="0" border="1">
    <tbody>
    <tr>
    <td width="33%"><div contenteditable="true">empty</div></td>
    <td width="34%"><div contenteditable="true">empty</div></td>
    <td width="33%"><div contenteditable="true">empty</div></td>
    </tr>
    <tr>
    <td><div contenteditable="true">empty</div></td>
    <td><div contenteditable="true">Lorem ipsum dolor sit amet,
    consectetuer
    adipiscing elit. Phasellus in sem lacinia nunc rutrum tempor. Vivamus
    facilisis.
    Vivamus lectus eros, aliquet id, tincidunt in, tempus quis, erat. Etiam
    scelerisque
    sem et massa. Cum sociis natoque penatibus et magnis dis parturient
    montes, nascetur
    ridiculus mus. Ut at arcu. Praesent et turpis ac urna ornare hendrerit.
    Mauris
    vitae pede a libero scelerisque egestas. Nunc sollicitudin, orci et
    commodo ultrices,
    nisl libero vulputate urna, in posuere ligula arcu ut libero. In
    ullamcorper neque
    ut mi.</div></td>
    <td><div contenteditable="true">empty</div></td>
    </tr>
    <tr>
    <td><div contenteditable="true">empty</div></td>
    <td><div contenteditable="true">empty</div></td>
    <td><div contenteditable="true">empty</div></td>
    </tr>
    </tbody>
    </table>
    </body>
    </html>

    I guess you can emulate this on Firefox using document.designMode
    property.

    Opera and Safary (at least) do not have the necessary TextRange
    methods. So you can get the selection using document.getSelection(),
    but you cannot reliably attach it to the particular place in the
    document (find the corresponding DOM block).
     
    VK, Jul 26, 2005
    #2
    1. Advertising

  3. - Hope this isn't a repeat post the first died -
    VK you're awesome - this works even better than I had hoped - with much
    less work on my part.
    Lorem ipsum threw me for a minute; I knew it looked familiar, thought
    it was Latin, and looked it up . . duh do I feel like an uneducated
    clod. :)
    Thanks for the help
    Pachydermitis
     
    Pachydermitis, Jul 26, 2005
    #3
  4. VK Guest

    Pachydermitis wrote:
    > - Hope this isn't a repeat post the first died -
    > VK you're awesome - this works even better than I had hoped - with much
    > less work on my part.
    > Lorem ipsum threw me for a minute; I knew it looked familiar, thought
    > it was Latin, and looked it up . . duh do I feel like an uneducated
    > clod. :)
    > Thanks for the help
    > Pachydermitis


    "Lorem ipsum" is the standard bogus text to use as placeholder. It's a
    "pseudo-Latin" - composed of Latin words but means nothing. I hope you
    did try to translate it! :)
     
    VK, Jul 26, 2005
    #4
  5. Robert Guest

    VK wrote:
    > wrote:
    >
    >>Hi all you JS experts,
    >>Is there any way to put a blinking ibeam cursor in middle of td text -

    >
    > You can set it very easy for IE by using contenteditable attribute


    Do you happen to know if something like that is possible for
    Mozilla/Firefox?
     
    Robert, Jul 28, 2005
    #5
  6. RobG Guest

    Robert wrote:
    > VK wrote:
    >
    >> wrote:
    >>
    >>> Hi all you JS experts,
    >>> Is there any way to put a blinking ibeam cursor in middle of td text -

    >>
    >>
    >> You can set it very easy for IE by using contenteditable attribute

    >
    >
    > Do you happen to know if something like that is possible for
    > Mozilla/Firefox?


    <URL:http://www.mozilla.org/editor/ie2midas.html>

    --
    Rob
     
    RobG, Jul 28, 2005
    #6
  7. Yes - the fact that it is the standard bogus placeholder text for
    typesetting came painfully back to memory - after I tried to translate
    it. :)
     
    Pachydermitis, Aug 3, 2005
    #7
    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. VB Programmer
    Replies:
    3
    Views:
    842
    VB Programmer
    Nov 29, 2004
  2. Paul  Smith
    Replies:
    5
    Views:
    2,548
    johannsig
    May 22, 2012
  3. Saurabh
    Replies:
    6
    Views:
    4,576
    Chris Smith
    May 30, 2004
  4. Domestos
    Replies:
    5
    Views:
    537
    de_doos
    Oct 6, 2005
  5. Bo Yang
    Replies:
    0
    Views:
    274
    Bo Yang
    Apr 7, 2006
Loading...

Share This Page