请举例说明,我用div做了,但是不能实现

解决方案 »

  1.   

    <tr>
    <td class="tdInput21L">付汇方式</td>
    <td class="tdInput21R"> <%ListBox.listBox(out,ListBox.TypeOfDictionary,"263","m_BillPayType",m_BillPayType,"90%","0","1","","cnName=\"付汇方式 \" isNec=yes onchange=\"checkType()\"");%>
    <input type="hidden" name="付汇方式" value="<%=m_BillPayType%>">
    </td>
    </tr><tr>
    <td class="tdInput21L">付汇币种</td>
    <td class="tdInput21R">
    <%ListBox.listBox(out,ListBox.TypeOfDictionary,"3","Currency",m_BillPayCurrency,"90%",disabled_Currency,"1","","cnName=\"付汇币种 \" isNec=yes ");%>
    <input type="hidden" name="付汇币种" value="<%=m_BillPayCurrency%>">
    </td>
    </tr>
    前一个列表,控制后面的这个区域显示
      

  2.   

    这个是例子.你看看
    <script>
    function change() {
      var tmp = txt.value
      if (tmp == new String("1")) {
        div1.style.visibility = "visible";
        div2.style.visibility = "hidden";
        div3.style.visibility = "hidden";
      }
      if (tmp == new String("2")) {
        div2.style.visibility = "visible";
        div1.style.visibility = "hidden";
        div3.style.visibility = "hidden";
      }
      if (tmp == new String("3")) {
        div3.style.visibility = "visible";
        div1.style.visibility = "hidden";
        div2.style.visibility = "hidden";
      }
    }
    </script>
    <body onload="change()">
    <input name="txt" type="text" onchange="change()" value="1">
    <div id="div1" style="visibility:hidden;POSITION:absolute;HEIGHT:13px;z-index:1"><table border='0'cellspacing='0' cellpadding='0' style='border-right: #000000 1px solid;border-top: #000000 1px solid;border-left: #000000 1px solid;border-bottom: #000000 1px solid;background-color: #FFFFE1;'><tr><td>adfadfdafdsfdsfasdf</td></tr></table></div>
    <div id="div2" style="visibility:hidden;POSITION:absolute;HEIGHT:13px;z-index:1"><table border='0'cellspacing='0' cellpadding='0' style='border-right: #000000 1px solid;border-top: #000000 1px solid;border-left: #000000 1px solid;border-bottom: #000000 1px solid;background-color: #FFE1FF;'><tr><td>dfdafdsfdsfasdfbvb</td></tr></table></div>
    <div id="div3" style="visibility:hidden;POSITION:absolute;HEIGHT:13px;z-index:1"><table border='0'cellspacing='0' cellpadding='0' style='border-right: #000000 1px solid;border-top: #000000 1px solid;border-left: #000000 1px solid;border-bottom: #000000 1px solid;background-color: #E1FFFF;'><tr><td>adfadfdadsfasdf</td></tr></table></div>
    </body>
      

  3.   

    你想要的onchange在你改变数字的时候并不能被触发。
    你可以加上这个函数
    function hhe()
    {
    if(event.keyCode==13)change();
    }
    并在<input name="txt" type="text" onchange="change()" value="1">中加上 onkeydown="hhe();"即
    <input name="txt" type="text" onchange="change()" value="1" onkeydown="hhe();">
    这样在你改完TEXT中的数字并回车后,你的DIV就可以改变了。
      

  4.   

    注明一下,你原来的onchange="change()"可以保留,这样在你改完TEXT的数字后不回车,而是失去焦点时,你的change()仍然可以被调用,因为只有这个时候,你输入的数据才被更新到TEXT控件。
      

  5.   

    各位:这个是我页面的部分源码
    <tr>
    <td class="tdInput21L">付汇方式</td>
    <td class="tdInput21R"> <%ListBox.listBox(out,ListBox.TypeOfDictionary,"263","m_BillPayType",m_BillPayType,"90%","0","1","","cnName=\"付汇方式 \" isNec=yes onchange=\"checkType()\"");%>
    <input type="hidden" name="付汇方式" value="<%=m_BillPayType%>">
    </td>
    </tr><tr>
    <td class="tdInput21L">付汇币种</td>
    <td class="tdInput21R">
    <%ListBox.listBox(out,ListBox.TypeOfDictionary,"3","Currency",m_BillPayCurrency,"90%",disabled_Currency,"1","","cnName=\"付汇币种 \" isNec=yes ");%>
    <input type="hidden" name="付汇币种" value="<%=m_BillPayCurrency%>">
    </td>
    </tr>
    通过checkType()函数实现隐藏付汇币种域,哪位能把上面的代码完成一下?