html 下增加个下拉框选第一个文本域则旁边显示textarea文本框 默认状态下不显示文本域 谢谢 php 写出来也
展开全部
<!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=gb2312" />
<title>test</title>
<script>
function chg(m){
if (m!=''){
if(m=="txt"){
document.getElementById("txt").style.display="";
document.getElementById("btn").style.display="none";
}else if(m=="btn"){
document.getElementById("txt").style.display="none";
document.getElementById("btn").style.display="";
}
}else{
document.getElementById("txt").style.display="none";
document.getElementById("btn").style.display="none";
}
}
</script>
</head>
<body>
<select id="sel" onChange="chg(this.value)">
<option selected>=选择类型=</option>
<option value="txt">txt</option>
<option value="btn">btn</option>
</select>
<textarea type="text" name="txt" id="txt" style="display:none"></textarea>
<input type="button" name="btn" value="btn" id="btn" style="display:none">
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>test</title>
<script>
function chg(m){
if (m!=''){
if(m=="txt"){
document.getElementById("txt").style.display="";
document.getElementById("btn").style.display="none";
}else if(m=="btn"){
document.getElementById("txt").style.display="none";
document.getElementById("btn").style.display="";
}
}else{
document.getElementById("txt").style.display="none";
document.getElementById("btn").style.display="none";
}
}
</script>
</head>
<body>
<select id="sel" onChange="chg(this.value)">
<option selected>=选择类型=</option>
<option value="txt">txt</option>
<option value="btn">btn</option>
</select>
<textarea type="text" name="txt" id="txt" style="display:none"></textarea>
<input type="button" name="btn" value="btn" id="btn" style="display:none">
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询