我想实现点击“button”实现对图片的隐藏和显示,一直实现不了,菜鸟又不知道问题出哪里了,求助啊。
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<script src="js/jquery.js"></script>
<script>
$("#mybutton").click(
function(){
if ($("#myimg").is(':hidden'))
{$("#myimg").show();}
else
{$("#myimg").hide();
}
});
</script>
</head>
<body>
<button id="mybutton">点击我隐藏/开启图片</button>
<img id="myimg" src="images/1.png"/>
</body>
</html>
<html>
<head>
<meta charset="utf-8">
<title>无标题文档</title>
<script src="js/jquery.js"></script>
<script>
$("#mybutton").click(
function(){
if ($("#myimg").is(':hidden'))
{$("#myimg").show();}
else
{$("#myimg").hide();
}
});
</script>
</head>
<body>
<button id="mybutton">点击我隐藏/开启图片</button>
<img id="myimg" src="images/1.png"/>
</body>
</html>