Page 1 of 1

highlight text

PostPosted: Wed Jun 01, 2016 11:03 am
by farhad2008
hi,
how do highlight line or word in container text document ?
what is javascript function for it?

thanks
farahd

Re: highlight text

PostPosted: Wed Jun 01, 2016 11:55 am
by Gaev
farhad2008:
how do highlight line or word in container text document ?

I assume you want a word or phrase to have a yellow (or other colored) background ?

what is javascript function for it?

Javascript is not the tool for doing rich text (like layout, bold, underline, etc.) ... html (< span>....< /span>) and css (add class or property for background color) should be used.

Re: highlight text

PostPosted: Thu Jun 02, 2016 10:21 am
by farhad2008
"I assume you want a word or phrase to have a yellow (or other colored) background ?"


yes i need highlight line by line in sequential of time

thanks

Re: highlight text

PostPosted: Thu Jun 02, 2016 6:02 pm
by Neosoft Support

Re: highlight text

PostPosted: Fri Jun 03, 2016 4:17 am
by luishp
Just use some CSS and JavaScript this way:

1) Add HTML to your container and be sure to assign an "id" to each line of text. You can use the <span> tag:

Code: Select all
<span id="p1">Line one</span><br>
<span id="p2">Line two</span><br>
<span id="p3">Line three</span><br>
<span id="p4">Line four</span><br>
<span id="p5">Line five</span><br>
<span id="p6">Line six</span><br>
<span id="p7">Line seven</span>


2) Add a button, double click it and add this code to highlight the first line:

Code: Select all
BeginJS
   $("#p1").css("background","red");
EndJS


Or add this code to highlight every single line with 1000 milliseconds delay between them:

Code: Select all
BeginJS
   $("#p1").css("background","red");
EndJS

Wait 1000
BeginJS
   $("#p2").css("background","red");
EndJS
EndWait

Wait 2000
BeginJS
   $("#p3").css("background","red");
EndJS
EndWait

Wait 3000
BeginJS
   $("#p4").css("background","red");
EndJS
EndWait

Wait 4000
BeginJS
   $("#p5").css("background","red");
EndJS
EndWait

Wait 5000
BeginJS
   $("#p6").css("background","red");
EndJS
EndWait

Wait 6000
BeginJS
   $("#p7").css("background","red");
EndJS
EndWait

Re: highlight text

PostPosted: Fri Jun 03, 2016 11:03 am
by farhad2008
hi,
very good luishp
thank you it is work in your sample but in the normal html page is not work
thanks