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';
}
精彩评论