HTMLText question

Robert Brenstein rjb at robelko.com
Wed Dec 16 13:49:12 EST 2009


On 16.12.2009 at 11:51 Uhr +0800 Kay C Lan apparently wrote:
>Craig,
>
>one further observation. If the field already contains formatted text, ie
>bold or coloured, doing what you are doing would set everything back to
>plain text except for word 2 so in most cases (but I accept not all) you'd
>want to do deal with htmlText exclusively:
>
>put the htmlText of fld "myField" into tHtml --not the plain text
>replace "<b>" with "<box><b>" in line 2 of  tHtml
>replace "</b>" with "</b></box>" in line 2 of tHtml
>set the htmlText of fld "myField to tHtml
>
>Of course one case where you would one to swap from one to the other is if
>you want to strip HTML tags. Set the htmlText of a field to a html file,
>then put the field into a Var, most of the html is then nicely stripped for
>you :-)
>
>HTH

A tad safer and more general technique is to

put "<box>" before word 2 of tHtml
put "</box>" after word 2 of tHtml

As other said, variable have htmltext property, just the content 
which can be html, so you need to work with it directly. Html comes 
into effect when such a content is put into a field and then 
displayed to user.

Robert



More information about the use-livecode mailing list