Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.javascript > #19827

Re: How to make selected text (a range of a text block) with red background color?

Newsgroups comp.lang.javascript
Date 2013-05-19 14:50 -0700
References <eadac30e-3421-4f40-aa3b-e0dda2219b7a@googlegroups.com>
Message-ID <5725d024-62dd-482c-87cd-74bfabc4346d@googlegroups.com> (permalink)
Subject Re: How to make selected text (a range of a text block) with red background color?
From justaguy <lichunshen84@gmail.com>

Show all headers | View raw


I should add (forgive me for top posting).

That the following code fails (does not do anything and no error), tested with Firefox 20.

<input type="button" onclick="var sel = document.getElementById("longtextstr").contentWindow.getSelection();sel.execCommand('foreColor',false, '#ff0000');sel.select();" style="background-color:Red;width:25;height:23" />


>On Sunday, May 19, 2013 3:20:13 PM UTC-4, justaguy wrote:
> Hi,
> 
> 
> 
> Say, I have the following block of text:
> 
> "
> 
> Commuters are bracing for a difficult trip around southwest Connecticut and to New York City beginning Monday as workers repair the Metro-North commuter rail line crippled by a derailment and crash.  Crews will spend days rebuilding 2,000 feet of track, overhead wires and signals following the collision...
> 
> "
> 
> And I want to have an ability to let a user to select, say, "rail" and "crash" with red background color, how?
> 
> With Firefox and Chrome.
> 
> 
> 
> Many thanks.

Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

How to make selected text (a range of a text block) with red background color? justaguy <lichunshen84@gmail.com> - 2013-05-19 12:20 -0700
  Re: How to make selected text (a range of a text block) with red background color? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2013-05-19 14:04 -0700
    Re: How to make selected text (a range of a text block) with red background color? justaguy <lichunshen84@gmail.com> - 2013-05-19 14:47 -0700
      Re: How to make selected text (a range of a text block) with red background color? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2013-05-19 15:24 -0700
  Re: How to make selected text (a range of a text block) with red background color? Cezary Tomczyk <cezary.tomczyk@gmail.com> - 2013-05-19 14:22 -0700
    Re: How to make selected text (a range of a text block) with red background color? justaguy <lichunshen84@gmail.com> - 2013-05-19 15:58 -0700
      Re: How to make selected text (a range of a text block) with red background color? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2013-05-19 16:05 -0700
        Re: How to make selected text (a range of a text block) with red background color? justaguy <lichunshen84@gmail.com> - 2013-05-19 17:59 -0700
          Re: How to make selected text (a range of a text block) with red background color? "Michael Haufe (TNO)" <tno@thenewobjective.com> - 2013-05-19 18:45 -0700
  Re: How to make selected text (a range of a text block) with red background color? justaguy <lichunshen84@gmail.com> - 2013-05-19 14:50 -0700
    Re: How to make selected text (a range of a text block) with red background color? JJ <duh@nah.meh> - 2013-05-21 06:06 +0700
      Re: How to make selected text (a range of a text block) with red background color? justaguy <lichunshen84@gmail.com> - 2013-05-21 10:05 -0700
        Re: How to make selected text (a range of a text block) with red background color? JJ <duh@nah.meh> - 2013-05-22 00:54 +0700
          Re: How to make selected text (a range of a text block) with red background color? justaguy <lichunshen84@gmail.com> - 2013-05-21 21:25 -0700
        Re: How to make selected text (a range of a text block) with red background color? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-05-21 22:38 +0200

csiph-web