87,990
社区成员
发帖
与我相关
我的任务
分享<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript">
window.onload = function() {
document.getElementById('btn_controller').onclick = function() {
var inputs = document.getElementById('demo').getElementsByTagName('input');
for (var i = 0; i < inputs.length; i ++) {
if (inputs[i].disabled) inputs[i].disabled = false;
else inputs[i].disabled = true;
}
var textareas = document.getElementById('demo').getElementsByTagName('textarea');
for( var i = 0; i < textareas.length; i ++) {
if (textareas[i].disabled) textareas[i].disabled = false;
else textareas[i].disabled = true;
}
}
}
</script>
</head>
<body>
<input type="button" id="btn_controller" value="切换" />
<div id="demo">
<input type="text" value="文本框" /><br />
<textarea></textarea>
<input type="button" value="按钮" />
</div>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style>
#yourform{ width:300px; height:300px; background:#cfe; position:relative; }
#shadelay{ width:300px; height:300px; display: none; z-index:1; position: absolute;top: 0px; left: 0px; background:#efc; -moz-opacity: 0.3; opacity: 0.3; filter: alpha(opacity=30);}
</style>
<script type="text/javascript">
function Tab() {
var layStatus = document.getElementById("shadelay").style.display;
if (layStatus == "none" || layStatus == "") {
document.getElementById("shadelay").style.display = "block";
}
else {
document.getElementById("shadelay").style.display = "none";
}
}
</script>
</head>
<body>
<input type="button" value="切换" onclick="Tab()" />
<div id="yourform">
<div id="shadelay"></div>
<input type="text" value="文本框" /><br />
<textarea rows="5" cols="30" ></textarea> <br />
<input type="button" value="按钮" />
</div>
</body>
</html>