<form action="input.do" name="formkk"> <table> <tbody> <tr> <td>text:</td> <td> <input type="text" name="text"> </td> </tr> <tr> <td>password:</td> <td> <input type="password" name="pass"> </td> </tr> <tr> <td>radio:</td> <td> <input type="radio" name="xingbie" value="1"> 男 <input type="radio" name="xingbie" value="2"> 女 </td> </tr> <tr> <td>checkbox:</td> <td> 足球:<input type="checkbox" name="hobby" value="1" /> 篮球:<input type="checkbox" name="hobby" value="2" /> 拍球:<input type="checkbox" name="hobby" value="3" /> 斗球:<input type="checkbox" name="hobby" value="4" /> </td> </tr> <tr> <td>hidden:</td> <td> <input type="hidden" value="123" name="hidden"/> </td> </tr> <tr> <td>option:</td> <td> <select name="opt" id="opt"> <option>1</option> <option>2</option> <option>3</option> <option>4</option> </select> </td> </tbody> </table> <input type="button" value="提交" onclick="javascript:check()"/> </form>
function check(){
var radio = document.getElementsByName("xingbie");
var checkbox = document.getElementsByName("hobby");
var select = document.getElementById("opt");
//获取select标签
var index = select.selectedIndex;
var text = select.options[index].text;
var value = select.options[index].value;
//获取radio标签
for(var i=0;i<xingbie.length;i++){
if(xingbie.item(i).checked){
var val = xingbie.item(i).getAttribute("value");
break;
}
continue;
}
//获取checkbox标签
for(var i=0;i<hobbys.length;i++){
if(hobbys[i].checked){
alert(hobbys[i].value);
}
continue;
}
//提交form表单
document.formkk.submit();
}
String[] hobbys = request.getParameterValues("hobby"); //checkbox
String text = request.getParameter("text"); //text
String password = request.getParameter("password"); //password
String xingbie = request.getParameter("xingbie"); //radio
request.getParameter("hidden");
request.getParameter("opt");//select
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有