显示或隐藏页面元素
[htML]
p align="center">
table width="200" border="1" cellspacing="0">
tr>
td width="50"> 姓名:/td>
td> 斌斌/td>
/tr>
tr id="salaryInfo">
td> 工资:/td>
td> 200 万元/年/td>
/tr> www.2cto.COM
tr>
td colspan="2">
input tyPE="button" value="显示工资"
onclick="document.getElementById('salaryInfo').style.display=''"/>
input type="button" value="隐藏工资"
onclick="document.getElementById('salaryInfo').style.display='none'"/>
/td>
/tr>
/table>
/p>
在设计页面的时候,我们经常会遇到需要在页面动态显示或隐藏页面元素的情况。示例如下:
[html]
p align="center">
table width="200" border="1" cellspacing="0">
tr>
td width="50"> 姓名:/td>
td> 斌斌/td>
/tr>
tr id="salaryInfo">
td> 工资:/td>
td> 200 万元/年/td>
/tr> www.2cto.com
tr>
td colspan="2">
input type="button" value="显示工资"
onclick="document.getElementById('salaryInfo').style.display=''"/>
input type="button" value="隐藏工资"
onclick="document.getElementById('salaryInfo').style.display='none'"/>
/td>
/tr>
/table>
/p>
觉得可用,就经常来吧! 欢迎评论哦! html5教程,巧夺天工,精雕玉琢。小宝典献丑了!
声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!
若转载请注明出处: 显示或隐藏页面元素
本文地址: https://pptw.com/jishu/586419.html