qq_35514032 2019-04-22 19:32 采纳率: 0%
浏览 449

js如何获取很多个select里面的optin的值 并且把值求和,传递到后台,我现在只会1个一个的获取求指点

检查 计算 人:分 房屋:分
提交 返回

function homsave() { var name = $("#text1").val(), idcode = $("#text2").val(); var remarks = $("#text34").val(), bank = $("#text35").val(); var mtion = $("#text36").val(); $.ajax({ type: "POST", //提交的方法 url:"/business/save", //提交的地址 data:$('#homesave').serialize(),// 序列化表单值 async: false, error: function(request) { //失败的话 alert("Connection error"); }, success: function(data) { //成功 alert(data); //就将返回的数据显示出来 window.location.href="跳转页面" } }); // var name = $("#text1").val(), idcode = $("#text2").val(); // var remarks = $("#text34").val(), bank = $("#text35").val(); // var mtion = $("#text36").val(); // if (remarks == null || remarks == "") { // alert("备注不能为空"); // return; // } // if (bank == null || bank == "") { // $("#text35").val("--"); // } // if (mtion == null || remarks == "") { // $("#text36").val("--"); // } alert(name+idcode) } function jc() { var remarks = $("#text34").val(), bank = $("#text35").val(); var mtion = $("#text36").val(); if (remarks == null || remarks == "") { $("#text34").val("--"); } if (bank == null || bank == "") { $("#text35").val("--"); } if (mtion == null || remarks == "") { $("#text36").val("--"); } } function js() { var text3 = $("#text3").find("option:selected").val(); var text4 = $("#text4").find("option:selected").val(); var text5 = $("#text5").find("option:selected").val(); var text6 = $("#text6").find("option:selected").val(); var text7 = $("#text7").find("option:selected").val(); var text8 = $("#text8").find("option:selected").val(); var text9 = $("#text9").find("option:selected").val(); var text10 = $("#text10").find("option:selected").val(); // var text11 = $("#text11").find("option:selected").val(); var text12 = $("#text12").find("option:selected").val(); var text13 = $("#text13").find("option:selected").val(); var text14 = $("#text14").find("option:selected").val(); var text26 = $("#text26").find("option:selected").val(); var text27 = $("#text27").find("option:selected").val(); var text28 = $("#text28").find("option:selected").val(); var text29 = $("#text29").find("option:selected").val(); var text30 = $("#text30").find("option:selected").val(); var text31 = $("#text31").find("option:selected").val(); var text32 = $("#text32").find("option:selected").val(); var text33 = $("#text33").find("option:selected").val(); var menfen = parseInt(text3)+parseInt(text4)+parseInt(text5)+parseInt(text6) +parseInt(text7)+parseInt(text8)+parseInt(text9)+parseInt(text10) +parseInt(text12)+parseInt(text13)+parseInt(text14); var homefen = parseInt(text26)+parseInt(text27)+parseInt(text28)+parseInt(text29) +parseInt(text30)+parseInt(text31)+parseInt(text32)+parseInt(text33); $("#men").val(menfen); $("#home").val(homefen) }

  • 写回答

1条回答

  • Mizzz迷醉 2019-04-23 00:17
    关注

    这代码。。。能格式化一下么?

    评论

报告相同问题?

悬赏问题

  • ¥15 kafka 分区副本增加会导致消息丢失或者不可用吗?
  • ¥15 微信公众号自制会员卡没有收款渠道啊
  • ¥15 stable diffusion
  • ¥100 Jenkins自动化部署—悬赏100元
  • ¥15 关于#python#的问题:求帮写python代码
  • ¥20 MATLAB画图图形出现上下震荡的线条
  • ¥15 关于#windows#的问题:怎么用WIN 11系统的电脑 克隆WIN NT3.51-4.0系统的硬盘
  • ¥15 perl MISA分析p3_in脚本出错
  • ¥15 k8s部署jupyterlab,jupyterlab保存不了文件
  • ¥15 ubuntu虚拟机打包apk错误