クイズ入力の入力の助けになればと思い整形要フォームを作成しました。 現在の第1案のフォーマットで出力します。投票中のフォーマットが決まり次第それに準ずる使用に変更したいと思います。 #js() {{{{ var ids=["quiz","ansRatio","choice1","choice2","choice3","choice4","answer"]; // フォームの初期化 window.onload = function(){ var input = document.getElementById("loadText").innerHTML="クイズの入力"; for (var i = 0; i < 7; i++) { var input = document.getElementById(ids[i]); input.onfocus = OnFocusQuizForm; input.onblur = OnBlurQuizForm; input.onkeypress = pressEnter; input.disabled = false; } var button1 = document.getElementById("createQuiz"); button1.onclick = create; button1.disabled = false; var button2 = document.getElementById("resetQuiz"); button2.onclick = clr; button2.disabled = false; } // Enterキーの動作 function pressEnter(){ if( event.keyCode == 13 ) create(); } // クイズのフォーマットしたテキストを出力 function create() { var formatedText = "|>|>|>|" + document.getElementById("quiz").value + "(" + document.getElementById("ansRatio").value + "%)|\n"; for(var i = 0; i < 4; i++){ formatedText += "|" + (i+1) + "."+ document.getElementById(ids[i+2]).value; } formatedText += "|\n"; formatedText += "#region(答え)\n" + document.getElementById("answer").value + "\n#endregion"; document.getElementById("formated").value = formatedText; } // テキストボックスの文字を消去する function clr() { for (var i = 0; i < 7; i++) { var input = document.getElementById(ids[i]); input.style.color = "GrayText"; input.value = input.defaultValue; } } // テキストボックスの文字を消す function OnFocusQuizForm(input) { var target = input.currentTarget; if (target.value == target.defaultValue) { target.value = ''; target.style.color = "" } } // テキストボックスの文字を再表示する function OnBlurQuizForm(input) { var target = input.currentTarget; if (target.value == '') { target.style.color = "GrayText" target.value = target.defaultValue; } } }}}} #html2(){{{ <div id="loadText">読み込み中です</div> <table name="quizform" style="border:none; width:690px; padding:5px;"> <tr style="border:none; padding:1px;"> <td colspan="4" style="width:620px; padding:1px;"><input type="text" id="quiz" tabindex = 0 style="color:GrayText; width:620px; height:20px;" disabled="true" size="90" value="クイズの内容を入力" /></td> <td colspan="1" style="width:60px; padding:1px;"><input type="text" id="ansRatio" tabindex = 1 style="color:GrayText; width:60px; height:20px;" disabled="true" size="25" value="正解率" /></td> </tr><tr style="border:none; padding:1px;"> <td style="width:170px; padding:1px;"><input type="text" id="choice1" tabindex = 2 style="color:GrayText; width:165px; height:20px;" disabled="true" value="選択肢1" /></td> <td style="width:170px; padding:1px;"><input type="text" id="choice2" tabindex = 3 style="color:GrayText; width:165px; height:20px;" disabled="true" value="選択肢2" /></td> <td style="width:170px; padding:1px;"><input type="text" id="choice3" tabindex = 4 style="color:GrayText; width:165px; height:20px;" disabled="true" value="選択肢3" /></td> <td style="width:170px; padding:1px;" colspan="2"><input type="text" tabindex = 5 id="choice4" style="color:GrayText; width:168px; height:20px;" disabled="true" value="選択肢4" /></td> </tr><tr style="border:none; padding:1px;"> <td colspan="5" style="padding:1px;"><input type="text" id="answer" tabindex = 6 style="color:GrayText; width:689px; height:20px;" disabled="true" value="答え" /></td> </tr><tr style="border:none; padding:1px; border:none"> <td colspan="5" style="border:none"> <div align="right"> <input id="createQuiz" type="button" value="作成" style="width:100px;" disabled="true" /> <input id="resetQuiz" type="reset" value="クリア" style="width:100px;" disabled="true" /> </div></td></tr> </table> <textarea id="formated" style="resize:none; width:690px" rows="5"></textarea> }}}