<p>I have a link that I dynamically create which looks something like the following:</p>

<pre><code>&lt;a onclick="Edit('value from a text column here')" href="javascript:void(null);"&gt;Edit&lt;/a&gt;
</code></pre>

<p>with the Edit function then taking the passed in value and putting it into a Yahoo Rich Text Editor. This works well except for when there is a single quote in the text being passed. The obvious problem being that the link then looks something like:</p>

<pre><code>&lt;a onclick="Edit('I'm a jelly donut')" href="javascript:void(null);"&gt;Edit&lt;/a&gt;
</code></pre>

<p>Any suggestions on what I can do? I'd rather not stray too far from the structure I am currently using because it is something of a standard (and maybe the standard sucks, but that's another question altogether).</p>

<p>Note: I am using ASP as my server side language.</p>

Convert quote charaters to their HTML equivalents,
```
&quot;
```
etc. before you insert them into the HTML. There's a
long list
of HTML/XML character codes on wikipedia.
There may well be a function to do this for you, depending on how you're dynamically generating the code: PHP has
htmlspecialchars
, and though I'm not familiar with ASP etc, I'm sure there are similar routines.