js点击显示图片

来源:互联网 发布:unity3d控制物体移动 编辑:程序博客网 时间:2024/04/29 11:31
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>js 显示隐藏图片</title><script>/*显示隐藏图片 * @param   id  div的id * @param   show | hide */function showImg(id, act){  if (act == 'show')  {    document.getElementById(id).style.visibility = 'visible';  }  else  {    document.getElementById(id).style.visibility = 'hidden';  }}</script></head><body><img  src="/banner/banner.gif" id="pid" style="visibility:hidden;"/><br /><span onclick="showImg('pid','show');">显示</span><span onclick="showImg('pid','hide');">隐藏</span></body></html>

0 0
原创粉丝点击