onclick event is not working inside echo
<pre><code>echo '&lt;a onclick="alert(\'alert\');"&gt;&lt;img src= "1.jpeg"&gt;&lt;/a&gt;';
</code></pre>

<p>It is working fine, But</p>

<pre><code>echo '&lt;a onclick="do();"&gt;&lt;img src= "1.jpeg"&gt;&lt;/a&gt;';
</code></pre>

<p>Its not working if i put that alert inside do() like</p>

<pre><code>&lt;script type="text/javascript"&gt;
function do()
{
    alert("alert");
}
&lt;/script&gt;
</code></pre>

<p>Can any body help on this.</p>
