首页前端开发HTML显示或隐藏页面元素

显示或隐藏页面元素

时间2024-01-25 10:32:46发布访客分类HTML浏览263
导读:收集整理的这篇文章主要介绍了html5教程-显示或隐藏页面元素,觉得挺不错的,现在分享给大家,也给大家做个参考。小宝典致力于为广大程序猿(媛)提供高品质的代码服务,请大家多多光顾小站,小宝典在此谢过。 在设计页面的时候,我们经常会遇到需要...
收集整理的这篇文章主要介绍了html5教程-显示或隐藏页面元素,觉得挺不错的,现在分享给大家,也给大家做个参考。小宝典致力于为广大程序猿(媛)提供高品质的代码服务,请大家多多光顾小站,小宝典在此谢过。 在设计页面的时候,我们经常会遇到需要在页面动态显示或隐藏页面元素的情况。示例如下:

 

[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核实处理,我们将尽快回复您,谢谢合作!

divHTMLpost-format-gallery

若转载请注明出处: 显示或隐藏页面元素
本文地址: https://pptw.com/jishu/586419.html
HTML5 标签语法变化和使用概念 HTML5标签与HTML4标签区别

游客 回复需填写必要信息