Note that there are some explanatory texts on larger screens.

plurals
  1. POpass id of controls running at server in .js file
    primarykey
    data
    text
    <p><strong>Head part</strong> </p> <pre><code>&lt;script type="text/javascript" &gt; function ChangeColor1(elementid) { document.getElementById(elementid).style.backgroundImage = "url('images/1.jpg')"; document.getElementById("&lt;%= img2.ClientID%&gt;").style.backgroundImage = "url('images/2.jpg')"; document.getElementById("&lt;%= imgchange.ClientID%&gt;").style.backgroundImage = "url('images/img1.JPG')"; } function ChangeColor2(elementid) { document.getElementById(elementid).style.backgroundImage = "url('images/1.jpg')"; document.getElementById("&lt;%= img1.ClientID%&gt;").style.backgroundImage = "url('images/2.jpg')"; document.getElementById("&lt;%= imgchange.ClientID%&gt;").style.backgroundImage = "url('images/img2.JPG')"; } &lt;/script&gt; </code></pre> <p>Body part</p> <pre><code> &lt;table &gt; &lt;tr&gt; &lt;td id="img1" runat="server" onmouseover="ChangeColor1(this.id)" style="background-image: url('images/2.jpg')"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td id="img2" runat="server" onmouseover="ChangeColor2(this.id)" style="background-image: url('images/2.jpg')"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td id="imgchange" runat="server"&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>here all is working fine but when i place the above script in <strong>.js file</strong> it does not get working.</p> <p>I think so that when i used to do onmouseover on img1 its id get passed but the id="img2" and id="imgchange" is not passed to the .js file</p> <p>so this problem occurs. how shall i pass my control id="img2" and id="imgchange" on doing onmouseover to id="img1" </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload