note 44772 deleted from function.addslashes by aidan
| From: | aidan@php.net | Date: | Thu, 19 Aug 2004 14:58:09 +0000 |
| Subject: | note 44772 deleted from function.addslashes by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-74939@lists.php.net to get a copy of this message | ||
Note Submitter: dichoume at iro dot umontreal dot ca
----
I want to suggest something about this quote
==============
guy_AT_datalink_DOT_net_DOT_au
30-Mar-2002 01:58
If you're trying to escape quotes in a javascript event as such:
<img src="foo.gif" OnMouseOver="alert('<? print $myString
?>')">
It helps to perform this first:
$myString = str_replace("'", "\'", $myString);
$myString = str_replace('"', "'+String.fromCharCode(34)+'",
$myString);
==============
I've used only addslashes(htmlentities($myString)),
it worked fine on both alert and confirm javascript functions.
exemple:
onClick="return (confirm('do this :\n<?=addslashes(htmlentities($myString))?>
?'))"