![](https://iknow-base.cdn.bcebos.com/lxb/notice.png)
z怎么根据你选的<s:select/>下拉框去控制下面的文本框值,不能用Action提交,要用Javascript写
1个回答
展开全部
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>new document</title>
<script type="text/javascript">
function changeSel(sel){
var val = sel.options[sel.selectedIndex].value;
val += sel.options[sel.selectedIndex].text;
document.getElementById("txt").value = val;
}
</script>
</head>
<body>
<select id="sel" onchange="changeSel(this)">
<option value="0">空</option>
<option value="1">百度</option>
<option value="2">Google</option>
</select>
<input type="text" value="123" id="txt">
</body>
</html>
<html>
<head>
<title>new document</title>
<script type="text/javascript">
function changeSel(sel){
var val = sel.options[sel.selectedIndex].value;
val += sel.options[sel.selectedIndex].text;
document.getElementById("txt").value = val;
}
</script>
</head>
<body>
<select id="sel" onchange="changeSel(this)">
<option value="0">空</option>
<option value="1">百度</option>
<option value="2">Google</option>
</select>
<input type="text" value="123" id="txt">
</body>
</html>
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询