一个下拉框联动的简单例子

<%@ include file="../bas/headSearch.jsp"%>
<BODY class="classSearchBody"   onkeypress="DoKeyPress();">
<html:form  styleId="frmSearch" action="/ssm/cdSwtInfoList.do?action=list" target="right_frame">
<table border=0 cellspacing=2 cellpadding=2 width="100%">

<tr>
<td class="classSearchTitle">类别名称:<br>
        <html:select name="basMapForm" property="hs(codeType)"  style="width:100%" onchange="clearInput();">
        <option></option>
            <ltcm:listcodetp />
        </html:select>
        </td>
</tr>

<tr id="ctn">
<td class="classSearchTitle">类别名称:<br><html:text name="basMapForm" property="hs(codeTypeName)"  style="width:100%" /></td>
</tr>

<tr>
<td class="classSearchTitle">代码值:<br><html:text name="basMapForm" property="hs(baseCode)"  style="width:100%" /></td>
</tr>

<tr>
<td class="classSearchTitle">代码名称:<br><html:text name="basMapForm" property="hs(baseName)" style="width:100%" /></td>
</tr>
<tr>
<td align=right><button name="btnSearch" onclick="DoSearch();">查询</button></td>
</tr>
</table>


<input type=hidden name="intTotalPages">
<input type=hidden name="intCurrentPage">
</html:form>

<script defer>
function clearInput()
{
    var obj=document.getElementById("hs(codeType)");
    var ctn=document.getElementById("ctn");
    if(obj.options[obj.selectedIndex].innerText!='')
    {
        document.getElementById("hs(codeTypeName)").value="";
        ctn.style.display="none";
    }
    else
    {
        ctn.style.display="";
    }

}

</script>
</BODY>
</HTML>

阅读更多
想对作者说点什么? 我来说一句

没有更多推荐了,返回首页

关闭
关闭
关闭