Span Tags in HTML

Ken Ray kray at sonsothunder.com
Mon Feb 9 10:08:21 CST 2009


> Anyone with any ideas on how to use <span> tags when setting the
> htmlText of a fld?  Example:
> 
> <html>
> <head>
> <style type="text/css">
> span.blue {color:lightskyblue;font-weight:bold}
> span.green {color:darkolivegreen;font-weight:bold}
> </style>
> </head>
> <body>
> <p>My mother has <span class="blue">light blue</span> eyes and my
> father has <span class="green">dark green</span> eyes.</p>
> </body>
> </html>
> 
> This works fine in any browser, but setting the htmlText of a fld
> ignores the <span> tags.

Sorry, Ray... the htmlText of a field only has limited HTML support, and
<span> tags aren't one of them, nor is any CSS. You'd have to replace your
<span> tags with old-style <font> tags in order to get what you want, so you
could do something like this (assuming field 1 contains the actual HTML and
you want to render it into field 2):

-- watch line wraps
on mouseUp
  put fld 1 into tData
  put replaceText(tData,"<style.*/style>","") into tData
  replace format("<span class=\"blue\">") with format("<font
color=\"lightblue\"><b>") in tData
  replace format("<span class=\"green\">") with format("<font
color=\"darkolivegreen\"><b>") in tData
  replace "</span>" with "</b></font>" in tData
  set the htmlText of fld 2 to tData
end mouseUp

HTH,

Ken Ray
Sons of Thunder Software, Inc.
Email: kray at sonsothunder.com
Web Site: http://www.sonsothunder.com/




More information about the metacard mailing list