开发者

How to show a next icon when clicking on a checkbox?

开发者 https://www.devze.com 2023-03-19 03:24 出处:网络
How to show a next button when click on a checkbox and it should be hidden when unclick? For the first time it will not show image when unclick and shows image when clicks on checkbox

How to show a next button when click on a checkbox and it should be hidden when unclick?

For the first time it will not show image when unclick and shows image when clicks on checkbox

My code is :

 <script type="text/javascr开发者_如何转开发ipt">

   function showNext()
   {
     document.getElementById('displayImage').style.visibility='visible';
   }


 </script>

and

<img id="displayImage" border="0" src="icons/next1.png" style="visibility:hidden" />

the problem is that it will not hide the next icon after deselecting the checkbox..

Will it possible to use if condition inside javascript? If yes please explain..

ie: if checkbox is checked then show image

else

does not show image.

Help appreciated.....


Something like this?

function showNext()
{
    var icon = document.getElementById('displayImage');
    icon.style.visibility = icon.style.visibility == 'visible' ? 'hidden' : 'visible';
}
0

精彩评论

暂无评论...
验证码 换一张
取 消