日期:2014-05-16  浏览次数:20433 次

请问将这个JavaScript改为Struts用怎么改啊.
<%@ page language="java" pageEncoding="GBK"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%>
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>

<html>
<head>
<title>JSP for TestForm form</title>
<script language="javascript">
//根据省出城市
function update_city( provinceValue, subTypeForm)
{
subTypeForm.length=0;
swicth(provinceValue)
{
case "":
subTypeForm.options[0]=new Option("请选择城市",""); 
subTypeForm.options[0].selected=true;
break;
case "湖北":
subTypeForm.options[0]=new Option("武汉","武汉"); 
subTypeForm.options[1]=new Option("孝感","孝感");
subTypeForm.options[0].selected=true;
break;
case "湖南":
subTypeForm.options[0]=new Option("长沙","长沙"); 
subTypeForm.options[1]=new Option("岳阳","岳阳");
subTypeForm.options[0].selected=true;
break;
case "广东":
subTypeForm.options[0]=new Option("深圳","深圳"); 
subTypeForm.options[1]=new Option("广州","广州");
subTypeForm.options[0].selected=true;
break;
}
return -1;
}

function getCity()
{
p = document.forms[0].province;
c = document.forms[0].city;
update_city(p.options[p.options.selectedIndex].value, c);
return ;
}

</script>

</head>
<body>
<html:form action="/test" onsubmit="return check();">
<table>
<tr>
<td>姓名:</td>
<td><html:text property="name" /></td>
</tr>
<tr>
<td>省份:</td>
<td>
<html:select property="province" onchange="getCity();">
<html:option value="">请选择省份</html:option>
<html:option value="湖北">湖北</html:option>
<html:option value="湖南">湖南</html:option>
<html:option value="广东">广东</html:option>
</html:select>
</td>
</tr>
<tr>
<td>城市:</td>
<td>
<html:select property="city" >
</html:select>
</td>
</tr>
<tr>
<td><html:submit property="submit" value="提交"/></td>
<td><html:reset property="reset" value="取消"/></td>
</tr>
</table>
</html:form>
</body>
</html>