<!doctype html>
<html>
<dead>
<meta charset="UTF-8">
<style type="text/css">
</style>
<script>
function dis(){
document.getElementById("test").removeAttribute("hidden");//通过removeAttribute()方法来移除Hidden属性,实现文字可见
}
function hid(){
document.getElementById("test").setAttribute("hidden","hidden");//通过setAttribute()方法来设置Hidden1属性,实现文字不可见
}
</script>
</dead>
<body>
<h3>显示和隐藏文字实验</h3>
<form>
显示:<input type="radio" checked name="xian" value="dis" οnclick="dis()">隐藏:<input type="radio" name="xian" value="hid" οnclick="hid()">
<!--radio代表单选按钮,name值相同的代表一组单选按钮-->
</form>
<span id="test">用这段文字来演示HTML5新增加的hidden属性</span>
</body>
</html>
验证HTML5的hidden属性
最新推荐文章于 2022-11-26 18:56:52 发布