重叠的html表单

时间:2011-10-21 14:30:24

标签: html css

我想通过在TD单元格顶部显示div来禁用表单,但我无法找到设置正确宽度和高度的方法,我的尝试是width:100%; height:100%;但是这比TD表面重叠得多

<table><tr><td>the data:<td>
  <div style="position:absolute;background-color:#cccccc;opacity:0.70;">not alowed</div>
  <form method="post" action="aaaa.htm">
    <input type=text><br>
    <input type="submit">
  </form>
</table>

2 个答案:

答案 0 :(得分:2)

我认为这种方法没有任何问题,它的效率与disabled="disabled"相同:

  • 输入值的两种方式都可以改变
  • 将提交值的两种方式
  • 双向阻止用户点击字段

建议:将叠加层与disabled="disabled"一起使用 - 看起来好多了,并且无法使用TAB按钮关注字段。

所以,回到这个问题 - 无法使用javascript重新调整overlay div的大小以获取<form>的宽度和高度。

这是我的 jsFiddle solution example with jQuery 它的基本功能是获取表单并在<div>内添加相同的宽度和高度。并停用表单中的所有<input><select><textarea><button>元素

答案 1 :(得分:0)

最好只删除div并执行此类操作

<input type=text disabled="disabled" value="Not Allowed">

示例:http://jsfiddle.net/GxNLY/