当前位置:Gxlcms > JavaScript > 用js实现控件的隐藏及style.visibility的使用

用js实现控件的隐藏及style.visibility的使用

时间:2021-07-01 10:21:17 帮助过:6人阅读

代码如下:

<!DOCTYPE html>
<html>
<body>
<p id="p1">这是一段文本。</p>
<input type="button" value="隐藏文本" onclick="document.getElementById('p1').style.visibility='hidden'" />
<input type="button" value="显示文本" onclick="document.getElementById('p1').style.visibility='visible'" />
</body>
</html>

人气教程排行