LiveCode Server - Html, Quotes & JS?

Rick Harrison harrison at all-auctions.com
Mon Jun 19 14:22:48 EDT 2017


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





More information about the use-livecode mailing list