How to get the name of clicked image and compare it with a php variable?
<p>Two images, placed by php:  </p>

<pre><code>echo "&lt;img onclick='test()' src=\"/img/Sun.png."\"&gt;";
echo "&lt;img onclick='test()' src=\"/img/Moon.png."\"&gt;";
$x = "Sun.png";
</code></pre>

<p>js:  </p>

<pre><code>function test(){
if (clicked_image_name == $x) ...do something
</code></pre>

<p>So, how to get the name of clicked image, and how to compare it with a php variable ?</p>
