lqs19890407
lqs19890407
2011-10-07 14:31

请问各位高手,我用dwr做了一个省市联动的效果,现在我想在action中取select 标签中option的值,而不是下标,我该怎么写呢?网上查到的方法都不行

  • it技术
  • 互联网问答
  • IT行业问题
  • 编程语言问答
  • 计算机技术
    <body onload="loadProvince()">
    <s:form action="dobranch!addBranch.action" id="myform">
        <table border="0" align="center">
            <tr>
                <td colspan="2" align="center">
                    添加营业网点
                </td>
            </tr>
            <tr>
                <td align="right">
                    网点名称
                </td>
                <td>

                    <input name="branch.branchName" type="text" id="textfield"
                        size="18">
                </td>
            </tr>
            <tr>
                <td align="right">
                    网点所属省份
                </td>
                <td>
                    <select id="province" onchange="loadCities(this.value)"
                        name="branch_branchProvince" style="width: 142px">
                        <option value="0">
                            --请选择省份--
                        </option>
                    </select>

                    <input type="hidden" name="provinceval" id="sel_text">
                </td>
            </tr>
            <tr>
                <td align="right">
                    网点所在城市
                </td>
                <td>
                    <select id="city" name="branch.branchCity" Style="width: 142px"> 

                        <option value="0">
                            --请选择城市--
                        </option>
                    </select>
                    <input type="hidden" name="cityval" id="sel_text2">
                </td>
            </tr>
            <tr>
                <td align="right">
                    网点电话
                </td>
                <td>
                    <label for="textfield2"></label>
                    <input name="branch.branchTel" type="text" id="textfield2"
                        size="18">
                </td>
            </tr>
            <tr>
                <td align="right">
                    网点邮编
                </td>
                <td>
                    <input name="branch.branchZip" type="text" id="textfield5"
                        size="18">
                </td>
            </tr>
            <tr>
                <td align="right">
                    网点经理编号
                </td>
                <td>
                    <input name="branch.branchManagerId" type="text" id="textfield3"
                        size="18">
                </td>
            </tr>
            <tr>
                <td align="right">
                    网点地址
                </td>
                <td>
                    <textarea name="branch.branchAddress" cols="18" rows="4"
                        id="textfield4"></textarea>
                </td>
            </tr>
            <tr>
                <td colspan="2" align="center">
                    <input type="submit" name="button" id="button" value="添加">
                    <input type="reset" name="button2" id="button2" value="重置">
                </td>
            </tr>

        </table>
    </s:form>
</body>--------------------------------------------------------------------------------------

js代码

function loadProvince() {
provinceBiz.getProvinces(processProvince);
}
function processProvince(data) {
DWRUtil.addOptions("province", data);
var obj = document.getElementById("province");
}
function loadCities(obj) {
cityBiz.getCities(obj, processCity);
}
function processCity(data) {
document.myform.city.options.length = 1;
DWRUtil.addOptions("city", data);

}


  • 点赞
  • 回答
  • 收藏
  • 复制链接分享

3条回答