Unable to pass string parameter to a simple Javascript function being invoked when a hyperlink is clicked
<p>It's a very simple question but I couldn't figure it out. I'm trying to pass parameters to a Javascript function which is invoked when a hyper link is clicked. </p>

<p>It works just fine when the parameters are number but doesn't work when one of them is of type string. I even tried to escape them but unfortunately to no avail.</p>

<p>The following is a very simple code.</p>

<pre><code>function temp(a, b)
{
    alert(a+ "   "+b);
}

&lt;a href="javascript:void(0);" onclick="temp(x, 2);"&gt;Click&lt;/a&gt;
</code></pre>

<p>It doesn't work complaining <code>x is undefined</code> <code>x</code> is here <code>onclick="temp(x, 2);"</code>. When I modify the function something like this <code>temp(1,2);</code>, it works and alerts as specified.</p>

<p>What might be the reason? What is the solution?</p>
