Help with escaping quotations in String that represents js string

Hello all,

I am constructing html / javascript from a class file.

I have a String as follows:

itemGeoLink ="<a href=# onclick=top.myframe.alertMe("+itemLon+","+itemLat+")>Click</a>;

Now the resulting String (System.out) is:

<a href=# onclick=top.myframe.alertMe(5.44,3.33)>Click</a>

What I need is:

<a href=# onclick=top.myframe.alertMe("5.44","3.33")>Click</a>//Notice the quotation marks.

Normally I would just insert an apostrophe but this string is being used in a json file so the apostrophe would not be compatible with my json file.

Thanks in advance.

[812 byte] By [gfortya] at [2007-11-26 17:56:28]
# 1

BTW,

I tried this as well:

<a href=# onclick=top.myframe.alertMe(\"+itemLon+\",\"+itemLat+\")>Click</a>

//The above gives me:

<a href=# onclick=top.myframe.alertMe("+itemLon+","+itemLat+")>Click</a>

gfortya at 2007-7-9 5:09:40 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...