标题:[求助]请问将这个JavaScript改为Struts用,怎么改啊.
只看楼主
当当
Rank: 1
等 级:新手上路
帖 子:235
专家分:0
注 册:2004-4-30
 问题点数:0 回复次数:0 
[求助]请问将这个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:select property="province" onchange="getCity();">
<table>
<tr>
<td>姓名:</td>
<td><html:text property="name" /></td>
</tr>
<tr>
<td>省份:</td>
<td>
<html:select property="province" onchange="return check();">
<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>

[此贴子已经被作者于2007-6-14 15:01:43编辑过]

搜索更多相关主题的帖子: Struts JavaScript 
2007-06-14 15:00



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-147452-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.478947 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved