猿问

关于数组和复选框的结合问题

怎么做才能让每个数组后面出现一个复选框?
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <script>
        var arr=["别称","医术","称为","高手","密切","其中","动人","疑难杂症","行医","当地","其他","苏醒"
 ,"康复","高明","病情","治愈","成熟","闻","谷子","仓库","堆","宣布","纪念","葫芦","象征","老翁"
 ,"拜师","悄悄","跪","诚恳","徒弟","属","物质","具体","内向","下降","相反","坚强","外向","上升"
 ,"理论","长期","观察","规律","运用","分析","器官","统一","按照","解释","平衡","损害","产生","手段"
 ,"黄帝内经","脏腑","三焦","原则","旺盛","引起","全面","分别","次要","关联","处理","发作","淤血"
 ,"发汗解表","燥湿化痰","平肝潜阳","泻下","内实证","症候","滋阴","组成","偏旁","缺少","概念","对应"
 ,"属性","炎热","概括","明白","起源","制约","循环","神秘","邻居","密码","天文","历法","临床","生理"
 ,"病理","诊断","辣","咸","伤害","反映","过度","烦躁","充实","脉象","著名","医学家","文学家"
 ,"历史学家","编写","并","立志","广泛","劝","坚持","动摇","降临","折磨","轻生","保全","钻研","吸引"
 ,"任职","重复","整理","记载","截取","针灸甲乙经","风痹症","脏象","经络","针法","格言","传统","造福"
 ,"失望","叹息","志向","高尚","保持","鼓舞","委婉","擅长"];

        arr.sort(function(){//随机打乱这个数组
 return Math.random()-0.5;
        })
        document.write(arr.join(" "));//控制台随机输出打乱后的字符
 </script>
</head>
<body>
<from>

</from>
</body>
</html>


Einson
浏览 1268回答 1
1回答

柠檬酸钠

for (var i=0;i<arr.length;i++) {   document.body.appendChild(arr[i]+'<input type="checkbox">') }
随时随地看视频慕课网APP
我要回答