html - Div与日期选择器重叠

标签 html css z-index

我有 2 个 div。

第一个是日期选择器 div,在它下面我有一个图表。当我尝试选择一个日期时,由于这两个 div 重叠,日期选择器不起作用。我想抑制图形 div 上的日期选择器。

//here is image
http://tinypic.com/r/1549hlz/8




<div id="cal" name="cal"  align="center" style="align: center; float: center; padding-    right: 150px;" >
<form    name="form" method="post">
<span >From</span> <input type="text" name="date_from" id="date_from"    onclick="setSens('date_to', 'max');" readonly="true">
<span >Till</span> <input type="text" name="date_to" id="date_to"   onclick="setSens('date_from', 'min');" readonly="true"> &nbsp; &nbsp; &nbsp;
<input name="submit"  onclick="show6(); update6();" type="submit"  id="submit"    value="Akım">&nbsp; &nbsp; &nbsp;<input name="submit"  onclick="show6(); update8();"      type="submit"  id="submit" value="Güç">
 </form>
 </div> 


<div id="graph3"  name="graph3"   align="center" style="display:none;width:1000px;height: 250px;">Akım-Zaman Grafiği</div><br/><br/><br/>

<script type="text/javascript">


 function update6(){
     graph drawing.....
 }
</script>

<script type="text/javascript">


 function update8(){
    another graph drawing..... (not important for  the case)
 }
 </script>


<script>
 function show6(){
document.getElementById("graph3").style.display = 'block';
document.getElementById("cal").style.display = 'block';
}
</script>

最佳答案

您还没有清除 float 。

把它放在两个 DIV 之间

    <div id="clear" style="clear:both;"></div>

所以...

<div id="cal" name="cal"  align="center" style="align: center; float: center; padding-    right: 150px;" >
<form name="form" method="post">
<span >From</span> <input type="text" name="date_from" id="date_from"    onclick="setSens('date_to', 'max');" readonly="true">
<span >Till</span> <input type="text" name="date_to" id="date_to"   onclick="setSens('date_from', 'min');" readonly="true"> &nbsp; &nbsp; &nbsp;
<input name="submit"  onclick="show6(); update6();" type="submit"  id="submit"    value="Akım">&nbsp; &nbsp; &nbsp;<input name="submit"  onclick="show6(); update8();"      type="submit"  id="submit" value="Güç">
</form>

    <div id="clear" style="clear:both;"></div>

</div>  

<div id="graph3"  name="graph3"   align="center" style="display:none;width:1000px;height: 250px;">Akım-Zaman Grafiği</div>

<br/><br/><br/>

附注无需声明 type="text/javascript"就可以了。对于所有三个脚本,您只需要一组标签。

'<script>
 function update6(){
     graph drawing.....
 }

 function update8(){
    another graph drawing..... (not important for  the case)
 }

function show6(){
document.getElementById("graph3").style.display = 'block';
document.getElementById("cal").style.display = 'block';
}

</script>'

关于html - Div与日期选择器重叠,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25832353/

相关文章:

html - CSS - 头部代码中没有滚动条

jquery - 在不改变布局的情况下增加/减少图像的大小

javascript - 滚动时修复/取消修复 Div

html - 自定义输入范围的处理程序

html - 我的 CSS 中的 Z-Index 问题

javascript - 如何动态调整 Spotfire 文本区域的大小

javascript - CSS div flip 仅在第一次工作

css - 将子元素置于其父元素之下

css - 如何使 CSS 形状自身裁剪以适合浏览器窗口而不是使其变宽

html - 使 div 向左而不是向右增长