jsp页面选择显示区域问题 请举例说明,我用div做了,但是不能实现 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 <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>前一个列表,控制后面的这个区域显示 这个是例子.你看看<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> 你想要的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就可以改变了。 注明一下,你原来的onchange="change()"可以保留,这样在你改完TEXT的数字后不回车,而是失去焦点时,你的change()仍然可以被调用,因为只有这个时候,你输入的数据才被更新到TEXT控件。 各位:这个是我页面的部分源码<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()函数实现隐藏付汇币种域,哪位能把上面的代码完成一下? JSP上传问题 点击不同radio出现不同的checkbox 高分,打印问题,求解,谢谢。 拜师啊 调用flash问题? Jsp里面获取一组checkbox的值出错 请问我怎么将数据库中的文本字段在JSP中用WORD显示? 高手请进:servlet中怎么直接传送一幅图片给JSP页面啊 http编写格式 普通的ssh开发的项目转成maven项目 xml相关 这个是什么意思
<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>
前一个列表,控制后面的这个区域显示
<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>
你可以加上这个函数
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就可以改变了。
<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()函数实现隐藏付汇币种域,哪位能把上面的代码完成一下?