|
热门文章 |
|
|
|
相关文章 |
|
没有相关文章 |
|
|
点击页面任何地方,将div隐藏,除了指定位置外 |
来源:JavaEye 更新时间:2010/9/21 15:27:18 阅读次数: 我要投稿 |
|
<!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=utf-8" /> <title>无标题文档</title> <style type="text/css"> div{border:1px solid #000; width:200px; height:200px; margin:10px; float:left} #aa{background-color:#00FFFF} </style> </head> <body> <div id="d1">d1</div> <div id="d2">d2</div> <div id="aa"> <p>我是aa</p> <table width="100%" border="0" bgcolor="#0000FF"> <tr> <th scope="col">1</th> <th scope="col">2</th> <th scope="col">3</th> <th scope="col">q</th> <th scope="col">a</th> </tr> <tr> <td>q</td> <td>e</td> <td>w</td> <td>w</td> <td>w</td> </tr> <tr> <td>w</td> <td>w</td> <td>w</td> <td>3</td> <td>1</td> </tr> </table> <p>我是aa</p> </div> <div id="d4">d3</div> </body> </html> <script type="text/javascript"> document.onclick = hideAA; function hideAA(e){ var src = e?e.target:event.srcElement; do{ if(src.id =="aa") return; src = src.parentNode; }while(src.parentNode) document.getElementById("aa").style.display = "none"; } </script> |
特效说明: |
点击页面任何地方,将div隐藏,除了指定位置外 |
|
上一篇文章: 利用js向表格动态追加行下一篇文章: JQuery EasyValidator表单验证插件 |
|
|