请教一下各位,以下格式的页面中,如何实现在选中其中一个option时,根据该option更新form2
<form id="form1">
<table>
<tr>
<td>
<select name="company" id="">
<option value="0">请选择...</option>
<s:iterator id="c" value="#request.companies">
<option value="<s:property value='#c.id'/>"> <s:property value="#c.name"/>
</option>
</s:iterator>
</select>
</td>
<td>姓名:</td>
<td><input type="text"/></td>
<td><a href="#">查找</a></td>
</tr>
</table>
</form>
<form id="form2">
<table>
.....
</table>
</form>
<form id="form1">
<table>
<tr>
<td>
<select name="company" id="">
<option value="0">请选择...</option>
<s:iterator id="c" value="#request.companies">
<option value="<s:property value='#c.id'/>"> <s:property value="#c.name"/>
</option>
</s:iterator>
</select>
</td>
<td>姓名:</td>
<td><input type="text"/></td>
<td><a href="#">查找</a></td>
</tr>
</table>
</form>
<form id="form2">
<table>
.....
</table>
</form>
这样就可以啊, onchange事件中调用 js修改对应表单的名字
function changeOption(){
var b_option =document.getElementById("bigtype").options;
for (var i=0;i<b_option.length;i++ )
{
if(b_option[i].selected){
自定义处理的内容
}
}
}
<select name="company" onchange="changeOption(); "id="">
function changeOption(){
var __obj =document.getElementById("bigtype");
var value = __obj.options[__obj.selectedIndex].value;
//do something to form2}
function changeOption(){
var b_option =document.getElementById("bigtype").options;
for (var i=0;i<b_option.length;i++ )
{
if(b_option[i].selected){
自定义处理的内容
}
}
}
function changeOption(){
var b_option =document.getElementById("bigtype").options;
for (var i=0;i<b_option.length;i++ )
{
if(b_option[i].selected){
自定义处理的内容
}
}
}
这样