4个回答
展开全部
做了实例,代码:
<!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>
</head>
<body><select name="select1" id="select1" onchange="showtext(this.options[this.selectedIndex].text)">
<option value="显示下列框文本">显示文本</option>
<option value="11">1</option>
<option value="22">2</option>
</select>
<select name="select2" id="select2" onchange="showtext(this.options[this.selectedIndex].value)">
<option value="获取Value">显示值</option>
<option value="11">1</option>
<option value="22">2</option>
</select>
<script type="text/javascript">
function showtext(sitem){
alert(sitem)
}
</script>
</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>
</head>
<body><select name="select1" id="select1" onchange="showtext(this.options[this.selectedIndex].text)">
<option value="显示下列框文本">显示文本</option>
<option value="11">1</option>
<option value="22">2</option>
</select>
<select name="select2" id="select2" onchange="showtext(this.options[this.selectedIndex].value)">
<option value="获取Value">显示值</option>
<option value="11">1</option>
<option value="22">2</option>
</select>
<script type="text/javascript">
function showtext(sitem){
alert(sitem)
}
</script>
</body>
</html>
展开全部
<%
response.write request("selvalue")
%>
<form name="afrm" method="post" action="">
<select name="select1" id="select1" onchange="showtext(this.options[this.selectedIndex].text)">
<option value="显示下列框文本">显示文本</option>
<option value="1">a</option>
<option value="2">b</option>
</select>
<!--用asp取这个文本框的值就行了-->
<input type="text" name="selvalue" id="selvalue" />
</form>
<script type="text/javascript">
function showtext(str){
document.getElementById("selvalue").value = str;
}
</script>
response.write request("selvalue")
%>
<form name="afrm" method="post" action="">
<select name="select1" id="select1" onchange="showtext(this.options[this.selectedIndex].text)">
<option value="显示下列框文本">显示文本</option>
<option value="1">a</option>
<option value="2">b</option>
</select>
<!--用asp取这个文本框的值就行了-->
<input type="text" name="selvalue" id="selvalue" />
</form>
<script type="text/javascript">
function showtext(str){
document.getElementById("selvalue").value = str;
}
</script>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
<form method="POST" name="sss">
<select size="1" name="D1">
<option value="这是value1">这是显示内容1</option>
<option value="这是value2" selected>这是显示内容2</option>
</select>
</form>
<script language="javascript">
var s=document.sss.D1.selectedIndex;
alert(document.sss.D1.options(s).text);
</script>
<select size="1" name="D1">
<option value="这是value1">这是显示内容1</option>
<option value="这是value2" selected>这是显示内容2</option>
</select>
</form>
<script language="javascript">
var s=document.sss.D1.selectedIndex;
alert(document.sss.D1.options(s).text);
</script>
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
不懂了, 要全部项的集合?
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询