- $("#btnSave").click(function(){
- //radio
- var raoLg = $("#menutop2 ul").length;
- for(var i =1;i<= raoLg;i++){
- var flag = $("input[name='radio"+i+"']:checked").val();
- //alert(flag);
- if(flag==null){
- alert("您还有未填项,无法提交!");
- return false;
- }
- }
- //checkbox
- var chkLg = $("#menutop1 ul").length;
- for(var i =1;i<= chkLg;i++){
- var lstInt = "";
- var items = document.getElementsByName("chk"+i);
- for(var i=0;i<items.length;i++){
- if(items[i].checked){
- lstInt = items[i].value + "," + lstInt;
- }
- }
- if (lstInt.length <= 0) {
- alert("您还有未填项,无法提交!");
- return false;
- }
- }
- //text textarea
- var flag = true;
- $("#theForm").find("input,textarea").each(function(){
- if(this.value==''){
- alert('您还有未填项,无法提交!');
- flag = false;
- return false;
- }
- });
- if(flag == true){
- document.theForm.action="${basePath}/questionnaire/front/formData/saveData.jspx";
- document.theForm.submit();
- }
- // /questionnaire/front/formData/saveData.jspx?id=
- });
//判断radio的值:
var flag = $("input[name='radio"+i+"']:checked").val();
alert(""flag);
//判断checkbox的值:
var items = document.getElementsByName("chk");
for(var i=0;i<items.length;i++){
if(items[i].checked){
alert(items[i]);
}
}
$("#type").find("option[value='"+factory+"']").attr("selected",true);