在JS中获得checkbox选中值及input后面的文本

jquery 获得select、radio、checkbox选择的text和value值 jquery 获得select、radio、checkbox选择的text和value值详解文档 立即下载

转自:http://blog.youkuaiyun.com/u014079773/article/details/51865596

<!doctype html>  
<html lang="en">  
 <head>  
  <meta charset="UTF-8">  
  <meta name="Author" content="">  
  <meta name="Keywords" content="">  
  <meta name="Description" content="">  
  <title>验证js获得多个checkbox选中值及input后面所跟文本</title>  
   <script type="text/javascript">  
       function clickBjjb() {  
       var checkboxValue= new Array();  
       var checkboxText= new Array();  
       var checkboxStr=document.getElementsByName("bjjb");    
       for(var i=0; i<checkboxStr.length; i++){  
        if(checkboxStr[i].checked){  
                //alert(checkboxStr[i].value+","+checkboxStr[i].nextSibling.nodeValue);  
            checkboxValue.push(checkboxStr[i].value);  
                    checkboxText.push(checkboxStr[i].nextSibling.nodeValue);  
         }  
        }   
        //输出值和文本  
         alert("checkboxValue:"+checkboxValue);  
             alert("checkboxText:"+checkboxText);  
           //把获得的数据转换为字符串传递到后台             
           checkboxValue=checkboxValue.toString();  
         checkboxText=checkboxText.toString();  
         window.location='某Action/netWorkingUpdate?checkboxValue='+checkboxValue+"&checkboxText="+checkboxText;  

  }   
</script>   
</head>   
<body>   
   <form id="checkboxform" method="post" action="">  
    <input type="checkbox" name="bjjb" value="1">交通事故<br>  
    <input type="checkbox" name="bjjb" value="2">自然灾害<br>  
    <input type="checkbox" name="bjjb" value="3">恶劣天气<br>  
   <input type="checkbox" name="bjjb" value="4">严重违法行为<br>  
   <input type="checkbox" name="bjjb" value="5">路面损毁<br>  
  <input type="button" onclick="clickBjjb()" value="报警级别" />  
 </form>   
</body>  
</html> 

后台获得参数为:

//获得的均为数组值。

String checboxValues=request.getParameter(“checboxValue”);

String checboxTexts=request.getParameter(“checboxText”);

//得到每个具体值

String checboxValue=checboxValues.split(“,”);

String checboxText=checboxTexts.split(“,”);

备注:

1:nextSibling是获得当前对象的下一个对象,nodeValue是返回一个节点的值

2:使用该方法必须保证文本值在input后面,否则checkboxStr[i].nextSibling.nodeValue获取不到文本值

Sigrity System Explorer Transient Analysis模式进行瞬态仿真分析操作指导-单端信号-并联端接 Sigrity System Explorer Transient Analysis模式可以用于瞬态仿真分析,通过搭建简易拓扑用于前仿真分析通道的时域性能,下面搭建一个简易的单端拓扑并且进行并联端接,以下图为例,准备好发送接收端的IBIS模型, (se_example.ibs,本例发送接收端都使用相同的IBIS模型),以及传输线的S参数模型(W1_welement_se.sp)最上方的图形界面是传输线的模型,本例是一个上下都有参考平面的带状线,右侧的梯形是蚀刻角度,根据W1和W2以及铜厚来确定。 阅读详情

相关推荐

低代码Agent开发框架使用指南(二)—Coze平台核心功能概览

本篇分享系统介绍了字节跳动推出的低代码智能体开发平台Coze。Coze以免费易用、多模型支持和便捷的跨平台发布为核心优势,显著降低了智能体开发门槛。文章详细解析了平台的六大核心功能:扩展能力边界的插件系统、增强认知的知识库、结构化数据管理的数据库、可视化图像处理的图像流、实现复杂逻辑编排的工作流,以及处理复杂任务的多智能体协作机制,全面展现了Coze平台的强大能力。

weixin_42782643的博客 1358

JS - 获取选中复选框的值(checkBox)

获取选中复选框的值(checkBox)

qq_37131747的博客 6739

大众奥迪诊断不求人:手把手解析SAE J2819(CAN TP2.0)协议报文与连接流程

本文深入解析大众奥迪车型诊断核心标准SAE J2819(CAN TP2.0)协议,详细拆解连接建立流程与报文控制字段。通过实战案例展示通道设置、参数协商等关键步骤,提供诊断设备配置建议和常见故障排查技巧,帮助工程师掌握汽车诊断通信协议的精髓。

weixin_30421809的博客 396

js 点击选取事件

先创建五个个input 给他个名字class叫check ,给一个checkbox选中触发事件,这样点击小方块就可以选中,再次点击取消 下面给他3个按钮button,分别为 全选allCheck(),不选noCheck(),反选fanCheck() 下面是js来实现全选 function allCheck() { var all = document.getElementsByClassName(“check”); for (var i = 0; i<all.length;i

qq_46063555的博客 1461

基于STM32与FPGA Cyclone IV的FSMC高速数据通信实战解析

本文详细解析了基于STM32的FSMC接口与FPGA Cyclone IV实现高速并行数据通信的实战方案。通过将FPGA模拟为SRAM设备,构建了MCU与FPGA之间的高速数据通道,并深入探讨了硬件连接、STM32软件配置、FPGA逻辑设计及性能优化等关键步骤,为图像处理、高速采集等需要大数据量交换的嵌入式应用提供了稳定高效的通信解决方案。

swift5iosmith的博客 294

绕开华为通道,获取解锁码解锁BootLoader

刷机有风险,操作需谨慎,如果因为各种因素导致手机变砖无法开机,本教程概不负责,望悉知 前言 这篇文章的大多内容是根据我自己找的一篇文章《绕开华为通道,获取解锁码解锁BootLoader》来编写的,里面的大部分内容是文章的原内容。下面的都是我参考文章中做了一些小部分的修改,增加了我华为P8手机的一些操作,下面开始讲述我的解锁过程。 因为华为官方在2018年的七八月份吧,关闭了解锁码的申请通道,这...

Martin.Mu `s Special Column 5万+

JS控制复选框选中状态

效果图: 源码: <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>全选练习</title> <script type="text/javascript"> window.onload = function(){

Etui۹(・༥・´)و的博客 4233

银河麒麟V10离线安装VLC播放器:依赖处理与3.0.9.2版本实操指南

在国产化操作系统日益普及的背景下,软件安装方式成为政企内网用户关注的重点。离线安装作为一种不依赖公网源的部署手段,常用于解决内网环境下的软件获取问题。其核心在于理解Linux包管理机制,如dpkg与apt对依赖关系的处理逻辑。掌握这一原理,不仅能应对多媒体软件的部署,也能提升系统维护效率。VLC作为跨平台多媒体播放器,凭借强大的解码能力与协议支持,广泛应用于本地视频播放、RTSP拉流及监控大屏等场景。本文从离线安装的通用概念出发,结合银河麒麟V10桌面版的实际环境,详细梳理了VLC 3.0.9.2离线包的获

weixin_32247165的博客 368

checkbox 选中触发js事件

checkbox点击的时候触发js事件 选择按钮代码如下: <div> <input type="checkbox" id="checkbox"> <span>本周不再显示</span> </div> js代码如下: <script> $("#checkbox").change(function(){ alert("成功触发checkbox改变事件"); }) </script> ...

qq_40088333的博客 1万+

GNSS/INS松组合导航实战:如何用卡尔曼滤波提升定位精度(附MATLAB代码)

本文深入探讨了GNSS/INS松组合导航的工程实践,详细阐述了如何利用卡尔曼滤波算法融合卫星与惯性数据以提升定位精度。内容涵盖从仿真环境搭建、误差状态卡尔曼滤波器(ESKF)设计,到状态与观测方程实现、噪声参数调试及常见问题排查的全过程,并提供了可直接运行的MATLAB代码,为开发高精度、鲁棒的组合导航系统提供实战指南。

weixin_29057163的博客 164

金属粘结剂喷射3D打印技术:工艺流程与后处理关键

金属粘结剂喷射(Binder Jetting)是一种创新的增材制造技术,通过逐层喷射粘合剂将金属粉末粘结成型,再经过脱脂和烧结等后处理工序获得最终零件。这项技术的核心优势在于无需支撑结构、可实现批量生产,并且材料利用率高。在3D打印领域,金属BJ技术特别适合中小尺寸、结构复杂且表面质量要求高的零件生产。其工艺流程包括前期数据处理、打印生胚阶段、拆包与清粉,以及关键的渗透、脱脂和烧结后处理环节。后处理工艺的控制直接决定了零件的机械性能和尺寸精度,其中烧结工艺尤为关键,需要精确控制温度曲线和气氛环境。金属BJ打

weixin_35751194的博客 83

用js实现点击一个复选框其它复选框也会被选中

内容描述:实现点击一个复选框其它复选框也全部选中,取消一个复选框其它也全部取消。 代码实现: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>js实现全选</title> <script> //window.onload里面的函数会在页面加载之后执行 window.onlo

psjasf1314的博客 1538

企业AI数据资产评估的自动化工具:AI应用架构师的使用指南

在AI驱动的企业数字化转型中,数据资产是支撑模型训练、业务决策的核心燃料。然而,80%的AI项目失败源于数据问题——低质量数据导致模型偏差、未评估的风险引发合规危机、价值不明确的数据浪费资源。手动数据资产评估效率低、易出错,无法满足规模化AI应用需求。本文将以AI应用架构师的视角,拆解企业数据资产评估的核心逻辑,用"餐厅选食材"的生活化比喻解释复杂概念,结合自动化工具的技术原理与实战案例,教你如何从0到1搭建数据资产评估体系。无论是数据质量检测、价值量化还是风险防控,你都能找到可落地的工具方案与实践步骤。

2502_91592937的博客 1629

js获得checkbox选中值及input后面的文本

js如何获得多个checkbox选中的值及input后面所跟的文本 验证js获得多个checkbox选中值及input后面所跟文本 function clickBjjb() { var checkboxValue= new Array(); var checkboxText= new Array(); var ch

Asan 2万+

OV9734 DATASHEET,完整规格书

OV9734完整规格书,包括电气参数,尺寸规格,寄存器配置表等

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

js如何获得多个checkbox选中的值及input后面所跟的文本

function termRow(){     //定义返回结果集     var termInfos=[];     //循环所有tr     //数组拼接通过“,”拼接在一起     return termInfos.join(",");     } //获取循环遍历的复选框  的value值 和后面的值 input type="checkbox" na

qq_37272886的博客 6022

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

js获取checkbox中所有选中值及input后面所跟的文本 .

转自;https://www.cnblogs.com/zhenmingliu/archive/2012/05/15/2502270.html 1 &lt;html&gt; 2 &lt;head&gt; 3 &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt; 4 &lt;title&gt;js&l

weixin_33916256的博客 177

Statistics and Machine Learning Toolbox

Statistics and Machine Learning Toolbox(带书签),MATLAB统计学习工具

js获取checkbox中所有选中值及input后面所跟的文本

  &lt;html&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=utf-8"&gt; &lt;title&gt;js&lt;/title&gt; &lt;/head&gt; &lt;script language="java

weixin_34327761的博客 133

input checkbox 获取选中值和设置选中状态

获取选中值JS代码: shisssss //nodestr s function getValueCB(nodestr){ var node = document.getElementsByName(nodestr); var nodeValue = []; var len = node.length; for (var i = 0; i < len; i++) { if (node[i].checked) { nodeValue.push(node[i].value); }

wusejiege6的博客 1万+

JS中怎么获取checkbox选中的值?

有两种方法: 1、方法一HTML结构如下: 2、方法二javascript代码如下: 3、显示效果如下: js获得多个checkbox选中的值的方法: 一、代码如下: 二、后台获得参数为: //获得的均为数组值: String checboxValues=request.getParameter("checboxValue"); String checboxTexts=request.getParameter("checboxText"); //得..

firstcode666的博客 2万+

JS根据id、value值对checkbox设置选中状态

最开始获取的是input value值设置checkbox选中状态,由于input value要使用计算业务,后来改造为id value值设置checkbox选中 <input type="checkbox" name="ChekRole" value="1" >超级管理员 <input type="checkbox" name="ChekRole" val...

编程人生的博客 1万+

使用JQuery获取input checkbox被选中的值代码

以下为使用JQuery获取input checkbox被选中的值代码: &lt;html&gt; &lt;head&gt; &lt;meta charset="gbk"&gt; &lt;!-- 引入JQuery --&gt; &lt;script src="jquery-1.3.1.js" type="text/javascrip

weixin_40620337的博客 8711

在js中获取 input checkbox里选中的多个值

思路: 利用name属性值获取checkbox对象,然后循环判断checked属性(true表示被选中,false表示未选中)。下面进行实例演示: html代码: <input type="checkbox" name="test" value="1"/><span>1</span> <input type="checkbox" name="test" value="2"/><span>2</span> <input type="

qq_41353397的博客 1053

使用css修改input框中checkbox的样式

概述    在页面设计时,我们经常使用input复选框。由于界面设计的需要,我们需要修改复选框的样式,使得界面更美观或者适应新的需求。由于CheckBox伪类修改比较复杂,通常修改的方式有两种,一个是链入图片,另一个是使用纯css的方法进行修改。链入图片的设计方式比较简单,但是需要预先设计或者下载图片,比较麻烦。纯css的方法,只需要在css文件中编写代码,个人觉得比较方便,因此,本文使用该方式对...

天涯的博客 17万+

前端 —— JavaScript 基础篇 23 --- js获取input 、radio、checkbox、select 的值

js:如何获取input的值 <lable>input的值:</lable> <input type="text" id="userName" placeholder="请输入用户名" /> <script type="text/javascript"> var userInput = document.getElementById('userName'); console.log(userInput.value;) </scr

宁静致远 3945

jquery获取checkbox选中的值

&lt;html&gt; &lt;head&gt; &lt;meta charset="gbk"&gt; &lt;!-- 引入JQuery --&gt; &lt;script src="jquery-1.3.1.js" type="text/javascript"&gt;&lt;/script&gt

FurtherSkyQ的博客 3万+
上一篇: 链接-JS设置CSS样式几种方式
下一篇: 欢迎使用优快云-markdown编辑器
StevenAC
博客等级 码龄10年 16粉丝 66原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值