LiveCode Server - Html, Quotes & JS?

Rick Harrison harrison at all-auctions.com
Mon Jun 19 15:58:27 EDT 2017


Hi Mike and Mark,

Thank you both for your suggestions!
I will give them a good try and get back to you.

Thanks again,

Rick

> On Jun 19, 2017, at 2:50 PM, Mike Bonner via use-livecode <use-livecode at lists.runrev.com> wrote:
> 
> Theres a couple things I do... For items like an href that are pretty
> predictable, I have a stack file with a template that can be used with
> merge.
> 
> So I'd have <A HREF="[[tUrl]]">[[tUrl]]</a> in a property and merge that
> sucker in. (could use a description in a variable rather than a 2nd tUrl if
> you'd like
> 
> put "http://www.google.com" into tUrl
> put merge(the atag  of stack "whatever") and voila, there it is.
> 
> Alternatively, remember that you can open and close the lc tags at your
> convenience.
> 
> So instead of jumping through hoops, you can close the lc tag ?> then put
> your reference
> <A HREF="http://www.google.com" onmouseover="movepic('button','pic-off.gif')"
> onmouseout="movepic('button','pic-on.gif')"><IMG NAME="button"
> SRC="pic-off.gif" ALT="Image"></A>
> 
> then open lc again with <?lc
> 
> You should even be able to put tiny chunks of lc interspersed into your
> href by <?lc put "http://www.google.com" ?> right inside the thing.
> 
> On Mon, Jun 19, 2017 at 12:22 PM, Rick Harrison via use-livecode <
> use-livecode at lists.runrev.com> wrote:
> 
>> I have a nice example button image swap routine
>> written in JavaScript which I’d like to use in a .lc script.
>> 
>> To use HTML etc. within a .lc script I have to put
>> the statement in double quotes such as:
>> 
>> put “<html>”
>> 
>> or
>> 
>> put “<A HREF=‘http://www.google.com' <http://www.google.com'/>>”
>> 
>> where I have to substitute single quotes for the normal double quotes to
>> make it work.
>> 
>> That’s fine until I have a statement that is already using both double and
>> single quotes.
>> The statement still needs to be converted into a .lc script format.  The
>> following statement
>> will get parsed the wrong way if one wants to put it into double quotes.
>> 
>> <A HREF="http://www.google.com" onmouseover="movepic('button','pic-off.gif')"
>> onmouseout="movepic('button','pic-on.gif')"><IMG NAME="button"
>> SRC="pic-off.gif" ALT="Image"></A>
>> 
>> becomes:
>> 
>> put "<A HREF="http://www.google.com" onmouseover="movepic('button','pic-off.gif')"
>> onmouseout="movepic('button','pic-on.gif')"><IMG NAME="button"
>> SRC="pic-off.gif" ALT="Image"></A>”
>> 
>> As you can see the above statement will not be parsed correctly.
>> 
>> Suggestions?
>> 
>> On a related note, if a user types in a word such as “can’t” into a field,
>> the apostrophe gets interpreted as
>> a single quote and that messes up the parsing of various .lc script
>> statements too.
>> 
>> How do you usually solve these issues?
>> 
>> Thanks,
>> 
>> Rick
>> 
>> 
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list