<script language="JavaScript"><!--function catch_keydown(sel){ switch(event.keyCode) { case 13: //Enter; sel.options[sel.length] = new Option("","",false,true); event.returnValue = false; break; case 27: //Esc; alert("text:" + sel.options[sel.selectedIndex].text + ", value:" + sel.options[sel.selectedIndex].value + ";"); event.returnValue = false; break; case 46: //Delete; if(confirm("确定要删除吗?")) { sel.options[sel.selectedIndex] = null; if(sel.length>0) { sel.options[0].selected = true; } } event.returnValue = false; break; case 8: //Back Space; var s = sel.options[sel.selectedIndex].text; sel.options[sel.selectedIndex].text = s.substr(0,s.length-1); event.returnValue = false; break; }}function catch_press(sel){ sel.options[sel.selectedIndex].text = sel.options[sel.selectedIndex].text + String.fromCharCode(event.keyCode); event.returnValue = false;}//--></script><body onload="banktypeNum.focus();"> <select name="banktypeNum" onkeydown="catch_keydown(this);" onkeypress="catch_press(this);"> <option>客户类别</option> <% String sql="select * from banktype_table"; Statement stats=dblink.getStmtread(); ResultSet rs=stats.executeQuery(sql); while(rs.next()){ String banktype_name=rs.getString("banktype_name"); out.print("<option value="+banktype_name); out.print(">"+banktype_name+"</option>"); } dblink.close(); %> </select> </body> java中 获取输入框和下拉的值banktypeNum=(String)request.getParameter("banktypeNum");
banktypeNum 从下拉中可以正常获取值,输入框中输入的值为空
banktypeNum 从下拉中可以正常获取值,输入框中输入的值为空
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货