rt
解决方案 »
- Ext4 tree 后台数据转换问题
- 财务帐务初始列表里,如何设置列只读,和统计合计数,js如何写。
- 人家制作的有脚本的网页,在自己电脑上该怎么设置才能显示原来的效果啊?
- JavaScript代码怎么隐藏?避免页面另存为后,用记事本可以看到源代码
- 取得根目录路径
- 晕了,NS_ERROR_DOM_INDEX_SIZE_ERR什么意思?
- 求助
- 怎么让span里的文字不能被选中。。
- 打印的问题,自定义页眉,页脚是怎么实现的?按照那个设置怎么没用??
- 如何截取指定长度的中文字符串
- 求教uploadify3.1的formdata问题
- 为什么 innerHTML 生成的代码,在触发另外一个函数之后就消失了?
<form>
...
<div id='div1'>
<div>
...
</from>
...部分代表div1层外 层外发生鼠标单击事件则隐藏div1 层内单击则不隐藏
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
#div1{ width:100px; height:100px; background:#f00;}
</style>
<script>
window.onload = function(){
var isOut = true;
var dom = document.getElementById('div1');
var other = window.document;
other.onclick = function(){
if(isOut){
dom.style.display = 'none';
}
isOut = true;
}
dom.onclick = function(){
isOut = false;
this.style.display = 'block';
}
}
</script>
</head>
<body>點擊(除div本身外)的任何地方關閉div1<br><div id="div1">我是div1</div>
</body>
</html>
$("#div2").click(function(){
$("#div1").hide();//隐藏id=div1的内部div
});
});<div id="div2" style="width:100px;height:100px;border:1px solid red;margin:1px;">
<div id='div1' style="width:50px;height:50px;border:1px solid blue;margin:1px">
div1
<div>
</div>
return false;//阻止冒泡
});
$(document).on("click",function(){
$("#div").hide();
});