{"id":229,"date":"2014-10-08T08:44:48","date_gmt":"2014-10-07T23:44:48","guid":{"rendered":"http:\/\/nantoka.filmm.info\/blog\/?p=229"},"modified":"2014-10-14T09:03:26","modified_gmt":"2014-10-14T00:03:26","slug":"html%e5%85%a5%e9%96%80%e3%81%9d%e3%81%ae7-if%e3%81%ae%e4%bb%a3%e3%82%8f%e3%82%8a%e3%81%abswitch%e3%82%92%e3%81%a4%e3%81%8b%e3%81%86","status":"publish","type":"post","link":"https:\/\/nantoka.filmm.info\/blog\/?p=229","title":{"rendered":"HTML\u5165\u9580\u305d\u306e7-if\u306e\u4ee3\u308f\u308a\u306bswitch\u3092\u3064\u304b\u3046"},"content":{"rendered":"<p>\u524d<a title=\"HTML5\u5165\u9580\u305d\u306e6-\u30ad\u30fc\u5165\u529b\u305d\u306e\uff13\" href=\"http:\/\/nantoka.filmm.info\/blog\/?p=225\">\u30dd\u30b9\u30c8<\/a>\u306b\u66f8\u304d\u307e\u3057\u305f\u304c\uff0cif\u306e\u4ee3\u308f\u308a\u306bswitch\u3092\u4f7f\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\uff0e<\/p>\n<p>if\u306f\u7bc4\u56f2\u3067\u64cd\u4f5c\u3057\u305f\u3044\u3068\u304d\u306b\uff0c\u4f8b\u3048\u3070\u300c10\u4ee5\u4e0a\u306a\u3089\u300d\u3068\u304b\u300c20\u4ee5\u4e0a\u306a\u3089\u300d\u3068\u3044\u3063\u305f\u5834\u9762\u3067\u4f7f\u3044\uff0cswitch\u306f\u5024\u3092\u6c7a\u3081\u6253\u3061\u3057\u305f\u3044\u3068\u304d\u300c10\u306a\u3089\uff0c5\u306a\u3089\u300d\u3068\u3044\u3046\u5834\u9762\u3067\u4f7f\u3044\u5206\u3051\u308b\u306e\u3067\u3082\u3044\u3044\u3067\u3057\u3087\u3046\uff0e<\/p>\n<hr \/>\n<p>switch\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u306e\u69cb\u9020<\/p>\n<pre class=\"lang:js decode:true \" title=\"Switch\u306e\u4f7f\u3044\u65b9\">switch(\u3053\u3053\u306b\u5909\u6570\u540d){ \/\/switch\u306f\u3053\u3053\u304b\u3089\r\ncase 10: \/\/\u5909\u6570\u304c10\u306e\u5834\u5408\u306e\u610f\u5473\u3000&lt;-10\u306e\u5f8c\u306f\u30b3\u30ed\u30f3\u3060\u3088\uff01\u30bb\u30df\u30b3\u30ed\u30f3\u3058\u3083\u306a\u3044\u3088\uff01\u3000\u3042\u3068\u2212\uff1e\u3000\u25cbcase 10\u3000\u00d7case10\u3000\u3067\u3059\r\nmyX = myX + sokudo;\/\/10\u306e\u6642\u306e\u51e6\u7406\r\nbreak; \/\/\u5909\u6570\u304c10\u306e\u6642\u306e\u51e6\u7406\u306f\u3053\u3053\u307e\u3067\u3088\r\n \r\ncase 20: \/\/\u5909\u6570\u304c20\u306e\u5834\u5408\u306f\uff0c\uff0c\r\n\/\/20\u306e\u6642\u306e\u51e6\u7406\r\nbreak; \/\/\u5909\u6570\u304c20\u306e\u6642\u306e\u51e6\u7406\u3053\u3053\u307e\u3067\u3088\r\n \r\ndefault: \/\/\u3069\u308c\u306b\u3082\u3072\u3063\u304b\u304b\u3089\u306a\u304b\u3063\u305f\u5834\u5408\u306f\r\n\/\/\u3069\u308c\u306b\u3082\u5408\u81f4\u3057\u306a\u3044\u3068\u304d\u306e\u51e6\u7406\u3092\u3053\u3053\u306b\r\nbreak; \/\/\u3069\u308c\u306b\u3082\u3072\u3063\u304b\u304b\u3089\u306a\u304b\u3063\u305f\u3068\u304d\u306e\u51e6\u7406\u3053\u3053\u307e\u3067<\/pre>\n<p>&nbsp;<\/p>\n<p>\u3068\u3044\u3046\u69cb\u9020\u3067\u3059\uff0e<\/p>\n<p>case 10\u306e<strong><em>break<\/em><\/strong>\u3092\u6d88\u3057\u3066\uff0c20\u304c\u6765\u3066\u3082<strong>10\u306e\u3068\u304d<\/strong>\u3068\uff0c<strong>20\u306e\u3068\u304d<\/strong>\u306e\u51e6\u7406\uff12\u3064\u3068\u3082\u5b9f\u884c\u3059\u308b\u306a\u3093\u3066\u65b9\u6cd5\u3082\u3042\u308b\u307f\u305f\u3044\u3067\u3059\u306d\uff0e<\/p>\n<p>\u3053\u306eswitch\uff0c\u30b2\u30fc\u30e0\u3067\u4f7f\u3046\u3068\u3059\u308c\u3070\uff0c\uff0c\uff0c\u79c1\u306f\u4f7f\u3063\u305f\u3053\u3068\u304c\u306a\u3044\u306e\u3067\u3059\u304c\uff0c1\u4e07\u70b9\u7a81\u7834\u6642\u306b\uff0c\u7a81\u7834\u3057\u305f<span style=\"text-decoration: underline;\">\u52b9\u679c\u97f3<\/span>\u30681\u4e07\u70b9\u306e\u6587\u5b57\u306e<span style=\"text-decoration: underline;\">\u30d5\u30a9\u30f3\u30c8<\/span>\u3068<span style=\"text-decoration: underline;\">\u8272<\/span>\u3068<span style=\"text-decoration: underline;\">\u5927\u304d\u3055\u3092<\/span>\u5909\u66f4\u3057\uff0c<span style=\"text-decoration: underline;\">\u3057\u3070\u3089\u304f\u8868\u793a<\/span>\u3092\u3055\u305b\u3066\u304a\u304f\u3000\u3068\u3044\u3046\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u5b9f\u884c\u3059\u308b\u3068\u304d\u306a\u3069\u306b\u3082\u4f7f\u3048\u305d\u3046\u3067\u3059\u306d\uff0e\u4e0b\u7dda\u90e8\u3060\u3051\u30675\u3064\u306e\u30d7\u30ed\u30b0\u30e9\u30e0\u304c\u5fc5\u8981\u3067\u3059\u304c\uff0c\uff0c\uff0c\u3081\u3093\u3069\u304f\u3055\u3044\u3088\u3046\u3067\u3059\u304c\uff0c\u30b2\u30fc\u30e0\u3092\u76db\u308a\u4e0a\u3052\u308b\u305f\u3081\u306b\u5fc5\u8981\u306a\u51e6\u7406\u3067\u3059\uff0e\u306d\uff0e<\/p>\n<p>\u3067\u30821\u4e07\u70b9\u3054\u3068\u306b\u540c\u3058\u30d1\u30bf\u30fc\u30f3\u3092\u8868\u793a\u3055\u305b\u305f\u3044\u306e\u306a\u3089\uff0c\u30ad\u30ea\u756a\u306e\u70b9\u6570\u3092<strong>\u5f15\u6570<\/strong>\u306b\u3057\u3066\uff0c\u70b9\u6570\u306e\u8868\u793a\u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u6e21\u3059\u3060\u3051\u306b\u306a\u308a\u307e\u3059\uff0e\u305d\u3046\u3059\u308b\u3068\u3059\u3054\u30fc\u304f\u697d\u306b\u306a\u308a\u307e\u3059\u3088\u306d\u301c<\/p>\n<hr \/>\n<p>\u524d\u30dd\u30b9\u30c8\u306e\u4e0a\u4e0b\u5de6\u53f3\u30ad\u30fc\u306e\u30d7\u30ed\u30b0\u30e9\u30e0<\/p>\n<pre class=\"lang:js decode:true \">&lt;!DOCTYPE html&gt;\r\n&lt;html&gt;\r\n&lt;head&gt;\r\n&lt;title&gt;Key2&lt;\/title&gt;\r\n&lt;meta charset=\"UTF-8\"&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n&lt;h1&gt;Key2&lt;\/h1&gt;\r\n&lt;canvas id=\"myCanvas\" width=\"300\" height=\"300\" style=\"border:1px solid #000000;\"&gt;&lt;\/canvas&gt;\r\n&lt;script type=\"text\/javascript\"&gt;\r\nvar canvas = document.getElementById(\"myCanvas\");\r\nvar context = canvas.getContext(\"2d\");\r\n \r\nvar migi = false;\r\nvar myX = 0;\r\nvar myY = 0;\r\nvar sokudo = 5;\r\nfunction kyesage(myEvt) {\r\nvar myCode = myEvt.keyCode;\r\ncontext.clearRect(myX, myY, 20, 20);\r\n \r\nswitch(myCode){\r\ncase 39:\r\nmyX = myX + sokudo;\r\nbreak;\r\n \r\ncase 40:\r\nmyY = myY + sokudo;\r\nbreak;\r\n \r\ncase 38:\r\nmyY = myY - sokudo;\r\nbreak;\r\n \r\ncase 37:\r\nmyX = myX - sokudo;\r\nbreak;\r\n \r\ndefault:\r\n\/\/\u3069\u308c\u306b\u3082\u5408\u81f4\u3057\u306a\u3044\u3068\u304d\u306e\u51e6\u7406\r\nbreak;\r\n}\r\n}\r\n \r\ndocument.onkeydown = kyesage;\r\n \r\nfunction draw() {\r\n \r\ncontext.fillStyle = \"#FF0000\";\/\/\u8d64\r\ncontext.fillRect(myX, myY, 20, 20);\r\n}\r\nsetInterval(draw, 10);\r\n \r\n&lt;\/script&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p>\u4e0a\u4e0b\u5de6\u53f3\u5165\u529b\u3092switch\u3067\u304a\u3053\u306a\u3063\u305f\u5834\u5408\u3067\u3059<\/p>\n<p>\u306f\u3044\uff0e\u884c\u6570\u306f\u591a\u3044\u3067\u3059\u304c\uff0c\u6587\u5b57\u6570\u306f\u5c11\u306a\u304f\u3066\u3059\u3063\u304d\u308a\u3057\u3066\u307e\u3059\u306d\u301c<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u524d\u30dd\u30b9\u30c8\u306b\u66f8\u304d\u307e\u3057\u305f\u304c\uff0cif\u306e\u4ee3\u308f\u308a\u306bswitch\u3092\u4f7f\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\uff0e if\u306f\u7bc4\u56f2\u3067\u64cd\u4f5c\u3057\u305f\u3044\u3068\u304d\u306b\uff0c\u4f8b\u3048\u3070\u300c10\u4ee5\u4e0a\u306a\u3089\u300d\u3068\u304b\u300c20\u4ee5\u4e0a\u306a\u3089\u300d\u3068\u3044\u3063\u305f\u5834\u9762\u3067\u4f7f\u3044\uff0cswitch\u306f\u5024\u3092\u6c7a\u3081\u6253\u3061\u3057\u305f\u3044\u3068\u304d\u300c10\u306a\u3089\uff0c5\u306a\u3089 &hellip; <a href=\"https:\/\/nantoka.filmm.info\/blog\/?p=229\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">HTML\u5165\u9580\u305d\u306e7-if\u306e\u4ee3\u308f\u308a\u306bswitch\u3092\u3064\u304b\u3046<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,11,7],"tags":[],"class_list":["post-229","post","type-post","status-publish","format-standard","hentry","category-html5","category-javascript","category-7"],"_links":{"self":[{"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=\/wp\/v2\/posts\/229","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=229"}],"version-history":[{"count":3,"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=\/wp\/v2\/posts\/229\/revisions"}],"predecessor-version":[{"id":296,"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=\/wp\/v2\/posts\/229\/revisions\/296"}],"wp:attachment":[{"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=229"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=229"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=229"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}