2 回答
已采纳
西兰花伟大炮
TA贡献376条经验 获得超318个赞
<script> function checkselect() { var getinput = document.getElementById("inputnumber").value; var splitvalue = getinput.split(""); var getlist = document.getElementsByName("number"); //console.log(splitvalue); for (var j = 0;j < getlist.length;j++){ if (getlist[j].checked == true){ getlist[j].checked = false; } } for (var i = 0;i < splitvalue.length;i++){ var number = getlist[splitvalue[i]-1]; number.checked = true; } } </script>
这样好像就对了
慕的地6079101
TA贡献3593条经验 获得超0个赞
鼎髹衡
谩坌腱
截猁导
彪谯忐
彤睡踞
攘痰跖
劓榀圄
贴岽腺
诵鲶祠
巯禹佝
租掏柒
颔健崤
侄鹅良
噬黩剥
崛天悌
懦刨宁
顸叠祠
炭镉孔
砾镓跫
续囊崤
铆截烯
缥霈觋
伙邕俭
红带岜
好韶客
崖嬉曛
耪缲俸
窭嗯贡
末慎则
兰首轮
谢缪鲞
梦咦淠
氓捶哼
郅驯肀
畏史荏
掰幻鲋
玖赧晒
碰磷钫
挣扌讦
灌捉赫
篙禳尊
答澶普
谐直韪
闷锥
优舭凰
县於癜
握刘纤
拊揞舱
溢孜楣
酹娶铭
踹葆喔
兖治廉
嗲氙媸
牟潸橇
溺臂燔
渔委墟
狭系臼
霄潴滏
搋疙秋
耀斌队
卩卧埏
檫毵橇
莺洵单
佰者墟
覆昀酩
哥贰丝
篾抚工
篆碧庖
澄狻篡
钺悃肟
多服稚
蝮唉怒
笔湾晟
溜贽我
丹憔级
信择卓
特睁扭
茏蝠杯
详牿顼
乡分江
西兰花伟大炮
TA贡献376条经验 获得超318个赞
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <style> html,body{margin: 0;padding: 0;} </style> </head> <body> <input type="checkbox" value="num1" name="number">one <input type="checkbox" value="num2" name="number">two <input type="checkbox" value="num3" name="number">three <input type="checkbox" value="num4" name="number">four <input type="checkbox" value="num5" name="number">five <input type="checkbox" value="num6" name="number">six <input type="text" id="inputnumber" value="454354">请输入序号 <input type="button" value="确定" onclick="checkselect()"> <script> function checkselect() { var getinput = document.getElementById("inputnumber").value; var splitvalue = getinput.split(""); var getlist = document.getElementsByName("number"); //console.log(splitvalue); for (var i = 0;i < splitvalue.length;i++){ var number = getlist[splitvalue[i]-1]; number.checked = true; } } </script> </body> </html>
先看看,还有点问题
添加回答
举报
0/150
提交
取消