前提・実現したいこと
ボタンを押す
↓
スタミナ1(checkbox) パワー1(checkbox) 守備1(checkbox) 絆50(checkbox)
発生している問題・エラーメッセージ
何も出ない
該当のソースコード
<!doctype html> <head> <title>名将甲子園 ミッション管理</title> <link rel="stylesheet" href="style.css"> <meta http-equiv="content-type" charset="utf-8"> </head> <body> <h2>名将甲子園 ミッション管理</h2> <form name="form1"> <select name="position"> <option value="pitch">投手</option> <option value="catch">捕手</option> <option value="naiya">内野手</option> <option value="gaiya">外野手</option> </select> <select name="rarity" required> <option value="" class="msg" disabled selected>-----レア度を選択-----</option> <option value="N">N</option> <option value="R">R</option> <option value="SR">SR</option> </select> <select name="sensyu" required> <option value="" class="msg" disabled selected>-----選手を選択-----</option> <option value="矢部">矢部</option> <option value="香本">香本</option> <option value="星井">星井</option> <option value="猪狩守">猪狩守</option> </select> <br> <input type="button" value="追加" onclick="mission()"> <pre><div id="wrapper"></div></pre> </form> <script> //class tsuika{ var br,no1,no2,no3,pos1,pos2,rar1,rar2,sen1,sen2,input; br=document.createElement("br"); no1=document.form1.position.selectedIndex; //選択肢を取得.1 pos1=document.form1.position.options[no1].value; //選択肢を取得.2 pos2=document.createTextNode(pos1); //文字に変換 no2=document.form1.rarity.selectedIndex; //選択肢を取得.1 rar1=document.form1.rarity.options[no2].value; //選択肢を取得.2 rar2=document.createTextNode(rar1); //文字に変換 no3=document.form1.sensyu.selectedIndex; //選択肢を取得.1 sen1=document.form1.sensyu.options[no3].value; //選択肢を取得.2 sen2=document.createTextNode(sen1); //文字に変換 input = document.createElement('input'); input.setAttribute('type', 'checkbox'); // [or] input.type = 'checkbox'; /* document.getElementById("wrapper").append(pos2); //追加 document.getElementById("wrapper").append(input); //追加 space(); document.getElementById("wrapper").append(rar2); //追加 document.getElementById("wrapper").append(input); //追加 space(); document.getElementById("wrapper").append(sen2); //追加 document.getElementById("wrapper").append(input); //追加 space(); */ function br(){ a=document.createElement("br"), document.getElementById("wrapper").append(a); } function cbx(){ //cb=document.createElement('input type="checkbox"'), [False] document.getElementById("wrapper").append("input"); } function space(){ document.getElementById("wrapper").append(" "); //追加 } /*function moji(str){ document.getElementById("wrapper").append("str"); //追加 }*/ function nor(a,b,c,d){ document.getElementById("wrapper").append(a); cbx(); space(); document.getElementById("wrapper").append(b); cbx(); space(); document.getElementById("wrapper").append(c); cbx(); space(); document.getElementById("wrapper").append(d); cbx(); space(); } function rare(a,b,c,d,e,f,g,h){ nor(a,b,c,d); document.getElementById("wrapper").append(e); cbx(); space(); document.getElementById("wrapper").append(f); cbx(); space(); document.getElementById("wrapper").append(g); cbx(); space(); document.getElementById("wrapper").append(h); cbx(); space(); } function sr(a,b,c,d,e,f,g,h,i,j){ rare(a,b,c,d,e,f,g,h); document.getElementById("wrapper").append(i); cbx(); space(); document.getElementById("wrapper").append(j); cbx(); space(); } function mission(){ if(pos2=="pitch"){ nor("スタミナ1","パワー1","守備1","絆50"); if(rar2=="N"){ switch(sen1){ case "猪狩守": nor("スタミナ1","パワー1","守備1","絆50"); break; //case "": //nor(""); //break; default: document.getElementById("wrapper").append("error"); } } } } </script> </body>
試したこと
わからない
補足情報(FW/ツールのバージョンなど)
pos2は文字が取得できている
rar2,sen2は文字が取得できていない
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/07/14 13:48