table的diaplay属性 加载的时候有数据就显示table

来源:互联网 发布:淘宝怎么使用微信支付 编辑:程序博客网 时间:2024/06/05 10:20

是刚跳到这个页面,有数据就显示table
加载的时候就执行这个判断<body onload="Change();">...</body>



 <input name="isflag" type="checkbox" id="isflag" value="1" onclick="change();"/>是否需要继续填写

<table id="a" style="display:none" >
<tr><td align="right" valign="middle" class="Forumrow"><b>特别注意事项:</b></td>
      <td align="left" class="Forumrow"><textarea name="notes" cols="80" rows="6" id="notes"><%=notes%></textarea></td></tr>
<tr>
      <td align="right" valign="middle" class="Forumrow"><b>邮寄地址:</b></td>
      <td align="left" class="Forumrow"><input name="address" type="text"  value="<%=address%>" size="60" /></td>
    </tr>
</table>

<script type="text/javascript">
function change()
{
if(document.getElementById("isflag").checked)
{
document.getElementById("a").style.display='';}
else
{
     document.getElementById("a").style.display = ((document.getElementById("notes").value == "" || document.getElementById("address").value == "") ? "none" : "block");

}
</script>

原创粉丝点击