代码如下:
JS:
function hidepic(){
var mychar = document.getElementById("con");
mychar.style.diplay="none";
}
function showpic(){
var mychar = document.getElementById("con");
mychar.style.display="block";
}
HTML:
<div class="main2">
<div id="con" ><h1>My Photo</h1>
<div class="img"><img src="http://www.huangxiaolong.net/wp-content/uploads/2015/07/psb.jpg" height="657px" width="370"></div><br/>
He is ugly.<input type="button" onClick="hidepic" value="Click disappear" />
Is cool.<input type="button" onClick="showpic" value="Look again" />
</div></div>
1,推荐用runjs,condepen打开很慢。
2,两个错误,一个是input的onclick函数需要括号,二是js中display书写错误
http://runjs.cn/detail/yn2u1qr0
在线等....我在用codepen编辑一个个人介绍页面,,
具体代码内容可以看http://codepen.io/huangxiaolong/pen/eNKKzX 麻烦大神指导一下小白,我想设置一下隐藏图片和显示图片的按钮