社区
Web 开发
帖子详情
如何用javascript取
的值?
yuanye2008
2005-09-11 03:41:30
如:
<input type="checkbox" name="value" >hello
<input type="checkbox" name="value" >javascript
<input type="checkbox" name="value" >world
<select name="select">
<option>1111</option>
<option>2222</option>
</select>
...全文
360
11
打赏
收藏
如何用javascript取<select> <check box>的值?
如: hello javascript world 1111 2222
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
11 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
layueer
2005-09-12
打赏
举报
回复
这个有什么问的呀,和text什么的都一样,就是
document.控件名称.value
documnet.value.value='';
<input type="checkbox" name="value" >hello
<input type="checkbox" name="value" >javascript
<input type="checkbox" name="value" >world
-----------------
document.select.value='';
<select name="select">
<option>1111</option>
<option>2222</option>
</select>
l1i2n3y4u5n6
2005-09-12
打赏
举报
回复
是document.select.options[document.select.options.selectedIndex].text
l1i2n3y4u5n6
2005-09-12
打赏
举报
回复
value没有赋值,当然是空值了如果你想取你看到的选项,可以用document.select.option[document.select.options.selectedIndex].text
davidmay
2005-09-12
打赏
举报
回复
高人啊,又学了一手
geelpheels
2005-09-12
打赏
举报
回复
<input type="checkbox" name="value" value="随意">
<select name="select">
<option value="1">1111</option>
<option value="2">2222</option>
</select>
yuanye2008
2005-09-11
打赏
举报
回复
for(i=0;i<document.form1.select.length;i++)
{
if(document.form1.select[i].selected==true)
alert(document.form1.select.options[i].value);
}
存在同样的问题,取出的是空值!
boy
2005-09-11
打赏
举报
回复
function CheckAll(form){
for (var i=0;i<form.elements.length;i++){
var e = form.elements[i];
if(e.type == 'checkbox' && e.checked){
alert(e.value);
}
}
}
yuanye2008
2005-09-11
打赏
举报
回复
document.select.option[document.select.options.selectedIndex].value;
我试了一下!上面的代码有错误!
document.select.options.selectedIndex 是正确的!
但是document.select.option[document.select.options.selectedIndex].value;
报错:说document.select.option不是对象!
我把document.select.option改为document.select.options.
然后:document.select.options[document.select.options.selectedIndex].value;
但是取出来的是空值!
boy
2005-09-11
打赏
举报
回复
for(i=0;i<select.length;i++)
{
if(select[i].selected==true)
alert(select.options[i].value);
}
yuanye2008
2005-09-11
打赏
举报
回复
谢谢!那check box 怎么处理?
jFresH_MaN
2005-09-11
打赏
举报
回复
document.select.option[document.select.options.selectedIndex].value;
react-native-
select
-multiple::
check
_
box
_with_
check
:可自定义的FlatList,允许您选择多行
import
Select
Multiple from 'react-native-
select
-multiple' const fruits = [ 'Apples' , 'Oranges' , 'Pears' ] // --- OR --- // const fruits = [ // { label: 'Apples', value: 'appls' }, // { label: '...
dxdatagrid-how-to-implement-a-three-state-
select
-all-
check
-
box
-for-in-a-group-row-t444368:DevExtreme、DevExtreme (HTML JS)、数据网格
DataGrid-如何在组行中实现三...此示例说明如何允许用户使用组行内的自定义 dx
Check
Box
选择相应组的所有行。 为此,实现了一个特殊的 Group
Select
ionHelper 助手类。 请注意,此解决方案旨在处理内存中(本地)数据。
Jquery 获
取
表单text,areatext,radio,
check
box
,
select
值
的代码
jquery radio
取
值
,
check
box
取
值
,
select
取
值
,radio选中,
check
box
选中,
select
选中,及其相关 获
取
一组radio被选中项的
值
var item = $(‘input[@name=items][@
check
ed]’).val(); 获
取
select
被选中项的文本 var ...
javascript
获
取
check
box
复选框获
取
选中的选项
有关
javascript
获
取
check
box
复选框的实例数不胜数,下面的这个示例,纯js实现的 var form = document.getElementById("form2"); var field = form.elements["test2"]; var option = Dining.get
Select
edOption(form...
vue页面报警告(Date.now()不能用作key)
在页面循环操作后发现报错,本来以为时v-if导致,排查代码发现是因为:key使用了Date.now(),Date.now() 是毫秒,遇到重复的很正常。Date.now()是毫秒级别的 程序执行是微秒级的 所以一样是正常的。
Web 开发
81,094
社区成员
341,711
社区内容
发帖
与我相关
我的任务
Web 开发
Java Web 开发
复制链接
扫一扫
分享
社区描述
Java Web 开发
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章