I have this (in php):
$text="test'it";

and later this:
"<input....onclick='test(\"".$text."\");'>"

and test() is:
function test(a){alert(a);}

The function doesn't display anything with "test'it" but displays "test it" ok. Htmlentities doesn't fix it and I can't find any other solution.
Thanks