javascript - Mouse enter and mouse leave events in asp.net -


i have 4 image buttons. wrote javascript code changing color of image on mouseenter. on mouseleave, original state shown below.

<script language="javascript" type="text/javascript">                  function mouseoverimage(id) {                               document.getelementbyid(id).src = "images/yellow.png";     }      function mouseoutimage(id) {            document.getelementbyid(id).src = "images/testimage.png";                      } </script>   

if click on button1, have change color yellow , mouse leave event not fired on situvation.

if click on button2, button1 should original state.

can help?

its easier if use jquery, here's sample code

$('#button1').on('click', function () {     //button 1 click event goes here     $(this).css("background-image", "url(images/yellow.png)"); });  $('#button1').hover(     function () {         //button 1 hover event     },     function () {        //button 1 hover out event      });  $('#button2').on('click', function () {     //button 2 click event goes here     $('#button1').css("background-image", "url(images/original.png)"); }); 

Comments

Popular posts from this blog

php - mySql Join with 4 tables -

css - Text drops down with smaller window -

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -