SitePoint Sponsor

User Tag List

Results 1 to 7 of 7

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2007
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How are they highlighting words in a textarea?

    I'm trying to figure out how they are doing this, but the code is so complex and convaluted that I can't figure it out. (not that I'm a genuis when it comes to this stuff anyway)

    http://spell.jacuba.com/ "free" spell checking for text areas. Somehow highlights questionable words in the text area as you type.

    How on earth do they highlight the words in a standard textarea?

    It looks like they are building a layer over it, but I don't understand how they figure out the correct position of the word from the textarea to the cover layer.

  2. #2
    SitePoint Evangelist pompopom's Avatar
    Join Date
    Feb 2004
    Location
    Huldenberg (Belgium)
    Posts
    426
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    with css you can change font-type + attributes for each form element

    - let's say they're keeping track on each character inserted between 2 [space] characters (except for the first word).
    - compare the word to a DB (or csv)
    - when there's no match they edit the word's CSS/font attributes

    seems the only/fastest way to do it to me...

    greetz,
    Koen
    The Path of excess leeds to the tower of wisdom (W. Blake)

  3. #3
    SitePoint Wizard gRoberts's Avatar
    Join Date
    Oct 2004
    Location
    Birtley, UK
    Posts
    2,439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    using javascript you can style a textarea.


  4. #4
    SitePoint Enthusiast
    Join Date
    Aug 2007
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, you can style a text area, but that would style the ENTIRE text area... Or am I missing something? They are changing the style of ONE or a few words in the textarea while leaving the rest of the words untouched. If that is something that can be done with CCS / Javascript, I would really love to see a sample or some docs on HOW. Nothing I can find shows that as being possible.

  5. #5
    SitePoint Wizard gRoberts's Avatar
    Join Date
    Oct 2004
    Location
    Birtley, UK
    Posts
    2,439
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    the quick reply is a textarea iirc and most javascript wysiwyg editors are textarea's.

    TinyMCE is the best example. Just search google for Javascript wysiwyg.


  6. #6
    SitePoint Enthusiast
    Join Date
    Jun 2004
    Location
    New Jersey
    Posts
    69
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    James, I think that you might find this article of help.

    http://www.mozilla.org/editor/ie2midas.html

    They are not formatting a physical text area, it is a area on the page which has 'document.designMode = "On"' (more or less).

  7. #7
    SitePoint Enthusiast
    Join Date
    Aug 2007
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ah... Ok, I see. Thank you!


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
  •