Home  >  Article  >  Web Front-end  >  javascript 控制 html元素 显示/隐藏实现代码_javascript技巧

javascript 控制 html元素 显示/隐藏实现代码_javascript技巧

WBOY
WBOYOriginal
2016-05-16 18:47:251426browse
1。编写js函数

2. 要显示/隐藏的html元素加上 id 属性





3,添加按钮,链接等触发 js 函数

显示/隐藏
javascript显示隐藏层

二:javascript控制页面控件隐藏显示的两种方法
javascript控制页面控件隐藏显示的两种方法,方法的不同之处在于控件隐藏后是否还在页面上占位
方法一:
document.all["PanelSMS"].style.visibility="hidden";
document.all["PanelSMS"].style.visibility="visible";
方法二:
document.all["PanelSMS"].style.display="none";
document.all["PanelSMS"].style.display="inline";
方法一隐藏后 页面的位置还被控件占用 只是不显示
方法二隐藏后 页面的位置不被占用
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn