Forked from: vinton's 配列でリンクを表示 View Diff (32) 配列の演算 vinton Follow 2012-06-22 00:14:15 License: MIT License Fork2 Fav0 View1983 Play Stop Reload Fullscreen Smart Phone Fork tree Readme JavaScript 12 lines HTML 8 lines CSS 22 lines 配列の演算 var keisan = [ {a:5,b:33}, {a:12,b:14}, {a:18,b:65} ]; function Kakezan(i){ var result = keisan[i].a*keisan[i].b; alert("答えは、"+result+"です。"); } <h1>配列の計算</h1> <table> <tr><th>添字</th><th>a</th><th>b</th><th>a×bを計算</th></tr> <tr><th>0</th><td>5</td><td>33</td><th><button onClick="Kakezan(0)">計算結果</button></th></tr> <tr><th>1</th><td>12</td><td>14</td><th><button onClick="Kakezan(1)">計算結果</button></th></tr> <tr><th>2</th><td>18</td><td>65</td><th><button onClick="Kakezan(2)">計算結果</button></th></tr> </table> 配列の演算 body { font-family: "ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", "メイリオ", Meiryo, Osaka, "MS Pゴシック", "MS PGothic", sans-serif; } table,th,td { border: 1px solid #000; border-collapse: collapse; } th { background-color: #eee; width: 100px; } td { text-align: center; width: 100px; } var keisan = [ {a:5,b:33}, {a:12,b:14}, {a:18,b:65} ]; function Kakezan(i){ var result = keisan[i].a*keisan[i].b; alert("答えは、"+result+"です。"); } <h1>配列の計算</h1> <table> <tr><th>添字</th><th>a</th><th>b</th><th>a×bを計算</th></tr> <tr><th>0</th><td>5</td><td>33</td><th><button onClick="Kakezan(0)">計算結果</button></th></tr> <tr><th>1</th><td>12</td><td>14</td><th><button onClick="Kakezan(1)">計算結果</button></th></tr> <tr><th>2</th><td>18</td><td>65</td><th><button onClick="Kakezan(2)">計算結果</button></th></tr> </table> body { font-family: "ヒラギノ角ゴ Pro W3", "Hiragino Kaku Gothic Pro", "メイリオ", Meiryo, Osaka, "MS Pゴシック", "MS PGothic", sans-serif; } table,th,td { border: 1px solid #000; border-collapse: collapse; } th { background-color: #eee; width: 100px; } td { text-align: center; width: 100px; } use an iframe compat browser, deer Play on jsdo.it games Author Share ブログに埋め込む QR Tag Download Complete! Description What kind of game? Control Device Smartphone Controllerjsdo.it WebSocket Controller» Mouse Keyboard Touch Device Fullscreen Activated Inactivated jsdo.it games から削除する Submit Author vinton URLhttp://d.hatena.ne.jp/vinton/ Webマスターになるべく毎日勉強しています! Tweet Default Panel Auto play Screenshot Readme JavaScript HTML CSS Size Width: px Height: px code <script type="text/javascript" src="http://jsdo.it/blogparts/uOKH/js"></script> Discussion Questions on this code? Forked sort by latest page views favorite forked forked: 配列の演算 life.is.j11 00 298 13/8/22 配列の演算ver2.0 vinton 10 897 26/0/22