JavascriptとHTMLを用いて開発をしています。
0から9のボタン押下後、テキストボックスへ数値の出力をするにはどのようにすればよいでしょうか?
以下がコードです。
<html> <head> <title></title> <style type="text/css"> .button { background: skyblue; border: 1px solid #DDD; border-radius: 4px; -moz-border-radius: 4px; -webkit-border-radius: 4px; color: #111; width: 100px; padding: 10px 0; cursor:pointer; font-size:20; font-weight:bold; } </style> <script type="text/javascript"> function chValie() { TextCheck = new Array("pass"); <!--テキストボックスの入力チェック--> for(i=0; i<TextCheck.length; i++) { txt = document.form.elements[TextCheck[i]].value; if(txt == "") { alert("暗証番号は必須です。"); return false; } } return true; "location.href='お引き出し3.html'" } </script> </head> <body onkeydown="return false;"> <h3>暗証番号を入力してください。</h3> <form method="post" name="form" id="test" action="お引き出し3.html"onSubmit="return chValie()"><input type="text" name="pass" value="" tabindex="1"style=" position:absolute; top: 100px;left:10px" placeholder="xxxx" title="4桁の暗証番号を入力してください。" >
<table border="0" width="1080" cellspacing="0" cellpadding="5" bordercolor="#333333" style=" position:absolute; top: 480px;left:10px;"> <tr> <td> <input type="button" value="7"name="seven" tabindex="2" style="WIDTH: 100px; HEIGHT: 50px"> <input type="button" value="8" name="eight" tabindex="3" style="WIDTH: 100px; HEIGHT: 50px"> <input type="button" value="9" name="night" tabindex="4" style="WIDTH: 100px; HEIGHT: 50px"> </td> </tr> </table> <table border="0" width="1080" cellspacing="0" cellpadding="5" bordercolor="#333333" style=" position:absolute; top: 540px;left:10px;"> <tr> <td> <input type="button" value="4" tabindex="6" style="WIDTH: 100px; HEIGHT: 50px"> <input type="button" value="5" tabindex="7" style="WIDTH: 100px; HEIGHT: 50px"> <input type="button" value="6" tabindex="8" style="WIDTH: 100px; HEIGHT: 50px"> </td> </tr> </table> <table border="0" width="1080" cellspacing="0" cellpadding="5" bordercolor="#333333" style=" position:absolute; top: 600px;left:10px;"> <tr> <td> <input type="button" value="1" tabindex="10" style="WIDTH: 100px; HEIGHT: 50px"> <input type="button" value="2" tabindex="11" style="WIDTH: 100px; HEIGHT: 50px"> <input type="button" value="3" tabindex="12" style="WIDTH: 100px; HEIGHT: 50px"> </td> </tr> </table> <table border="0" width="1080" cellspacing="0" cellpadding="5" bordercolor="#333333" style=" position:absolute; top: 660px;left:10px;"> <tr> <td> <input type="button" value="0" tabindex="14" style="WIDTH: 310px; HEIGHT: 50px"> </td> </tr> </table> <input type="submit" value="確認"class="button" name="Check" tabindex="17"style="WIDTH: 150px; HEIGHT: 50px; position:absolute; top: 850px;right:10px"onclick=" check()"> <input type="reset" value="訂正"class="button" name="Correction" tabindex="16"style="WIDTH: 150px; HEIGHT: 50px; position:absolute; top: 850px;right:170px" > <input type="submit" value="メインメニュー"class="button" name="Back" tabindex="15"style="WIDTH: 150px; HEIGHT: 50px; position:absolute; top: 850px;left:10px" onclick="location.href='メインメニュー.html'"> </form> </body> </html>回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2015/07/12 12:26