{"id":494,"date":"2014-11-24T16:52:45","date_gmt":"2014-11-24T07:52:45","guid":{"rendered":"http:\/\/nantoka.filmm.info\/blog\/?p=494"},"modified":"2014-11-24T17:11:43","modified_gmt":"2014-11-24T08:11:43","slug":"%e3%83%96%e3%83%a9%e3%82%a6%e3%82%b6%e3%81%ab%e3%83%87%e3%83%bc%e3%82%bf%e3%82%92%e4%bf%9d%e5%ad%98%e3%81%a7%e3%81%8d%e3%82%8bwebstorage%e3%81%ae%e3%82%b5%e3%83%b3%e3%83%97%e3%83%ab","status":"publish","type":"post","link":"https:\/\/nantoka.filmm.info\/blog\/?p=494","title":{"rendered":"\u30d6\u30e9\u30a6\u30b6\u306b\u30c7\u30fc\u30bf\u3092\u4fdd\u5b58\u3067\u304d\u308bwebstorage\u306e\u30b5\u30f3\u30d7\u30eb"},"content":{"rendered":"<p><a href=\"http:\/\/www.atmarkit.co.jp\/ait\/articles\/1108\/12\/news093_2.html\">\u3053\u3053<\/a>\u306e\u30b5\u30f3\u30d7\u30eb\u3092\u5c11\u3057\u6539\u9020\u3057\u3066\u3044\u307e\u3059\uff0e<\/p>\n<pre class=\"lang:default decode:true\" title=\"webstorage sample\">&lt;!DOCTYPE html&gt;\r\n&lt;html lang=\"ja\"&gt;\r\n&lt;head&gt;\r\n&lt;meta charset=utf-8&gt;\r\n&lt;script&gt;\r\n\/\/\u5909\u6570storage\u306blocalStorage\u3092\u683c\u7d0d\r\nvar myData = localStorage;\/\/\u305f\u3076\u3093\u201dlocalstorage\u201d\u3068\u3044\u3046\u306e\u306f\u5909\u3048\u3066\u306f\u3044\u3051\u306a\u3044\r\n\r\n\/\/myData\u306b\u4fdd\u5b58\u3059\u308b\r\nfunction dataSave() {\r\n  var myKey = document.getElementById(\"mykey\").value;\r\n  var myValue = document.getElementById(\"myvalue\").value;\r\n  myData.setItem(myKey, myValue);\r\n  show_result();\r\n}\r\n\r\n\/\/\u30c7\u30fc\u30bf\u3092\u6d88\u53bb\r\nfunction myclear() {\r\n  myData.clear();\r\n show_result();\r\n}\r\n\r\n\/\/\u4fdd\u5b58\u3055\u308c\u3066\u3044\u308b\u30c7\u30fc\u30bf\u3092\u30ea\u30b9\u30c8\u8868\u793a\u3059\u308b\r\nfunction show_result() {\r\n var result = \"\";\r\n  \/\/\u4fdd\u5b58\u3055\u308c\u3066\u3044\u308b\u30c7\u30fc\u30bf\u306e\u6570\u3060\u3051\u30eb\u30fc\u30d7\r\n  for(var i=0; i&lt;myData.length; i++){\r\n    \/\/i\u756a\u76ee\u306e\u30ad\u30fc\u3092\u53d6\u5f97\r\n  \/\/  var k = myData.key(i);\r\n    var calledData = myData.key(i);\r\n\r\n    result += calledData + \"\u306f\" + myData.getItem(calledData) + \"\u3067\u3059&lt;br&gt;\";\r\n  }\r\n  \/\/\u4e0a\u306e\u30eb\u30fc\u30d7\u3067\u4f5c\u6210\u3055\u308c\u305f\u30c6\u30ad\u30b9\u30c8\u3092\u8868\u793a\u3059\u308b\r\n  document.getElementById(\"show_result\").innerHTML = result;\r\n}\r\n\r\n\r\n  \/\/ \r\n  function removeStorage() {\r\n    var key = document.getElementById(\"sakujoKey\").value;\r\n    myData.removeItem(key);\r\n    key = \"\";\r\n    show_result();\r\n  }\r\n\r\n&lt;\/script&gt;\r\n&lt;title&gt;Web Storage\u3000\u30b5\u30f3\u30d7\u30eb&lt;\/title&gt;\r\n&lt;\/head&gt;\r\n&lt;body onload=\"show_result();\"&gt;&lt;!--\u3000\u2190\u3053\u3053\u3067\u7d50\u679c\u3092\u81ea\u52d5\u8868\u793a\u3055\u305b\u3066\u3044\u308b--&gt;\r\n&lt;p&gt;\r\n\u30ad\u30fc\uff1a&lt;input id=\"mykey\" type=\"text\"&gt;\r\n\u5024\uff1a&lt;input id=\"myvalue\" type=\"text\"&gt;\r\n&lt;input type=\"button\" value=\"\u30b9\u30c8\u30ec\u30fc\u30b8\u306b\u4fdd\u5b58\" onClick=\"dataSave()\"&gt;\r\n&lt;\/p&gt;\r\n&lt;p&gt;\r\n&lt;div id=\"show_result\"&gt;&lt;\/div&gt;\r\n&lt;input type=\"button\" value=\"\u30b9\u30c8\u30ec\u30fc\u30b8\u3092\u30af\u30ea\u30a2\" onClick=\"myclear()\"&gt;\r\n\r\n&lt;input type=\"button\" value=\"\u30ea\u30b9\u30c8\u8868\u793a\" onClick=\"show_result()\"&gt;\r\n&lt;br \/&gt;\r\n\u524a\u9664\u3059\u308b\u30ad\u30fc\uff1a&lt;input id=\"sakujoKey\" type=\"text\"&gt;\r\n  &lt;button id=\"button\" onclick=\"removeStorage()\"&gt;\u3053\u306e\u30ad\u30fc\u3092\u524a\u9664&lt;\/button&gt;\r\n&lt;\/p&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/pre>\n<p>\u3053\u306e\u30c7\u30fc\u30bf\u306f\u5171\u6709\u3067\u304d\u308b\u306e\u3067\uff0c\u540c\u3058\u30b5\u30fc\u30d0\uff08\u3067\u5224\u5225\u3057\u3066\u3044\u308b\uff09\u3067\u3042\u308c\u3070\u5225\u306e\u30da\u30fc\u30b8\u304b\u3089\u3067\u3082\u3053\u306e\u30c7\u30fc\u30bf\u3092\u307f\u3089\u308c\u308b\uff0e<\/p>\n<p>\u305d\u3053\u3067\uff0c\u66f8\u304d\u8fbc\u307f\u7528\u30da\u30fc\u30b8\u3068\uff0c\u8aad\u307f\u51fa\u3057\u3088\u3046\u30da\u30fc\u30b8\u3092\u5206\u3051\u3066\uff0c\u666e\u6bb5\u306f\u8aad\u307f\u51fa\u3057\u7528\u30da\u30fc\u30b8\uff0c\u7279\u5225\u306a\u6642\u306b\u66f8\u304d\u8fbc\u307f\u3088\u3046\u30da\u30fc\u30b8\u3078\u79fb\u52d5\u3057\u3066\u30c7\u30fc\u30bf\u3092\u8ffd\u52a0\u3068\u3044\u3046\u306e\u3082\u53ef\u80fd\u3067\u3059\uff0e<\/p>\n<p>\u30c7\u30fc\u30bf\u306f\u30af\u30ea\u30a2\u4ee5\u5916\u306b\u3082\uff0c\u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u6307\u5b9a\u3057\u3066\u524a\u9664\u3068\u3044\u3046\u65b9\u6cd5\u304c\u3042\u308a\u307e\u3059\uff0e<\/p>\n<p>\u300c\u524a\u9664\u3059\u308b\u30ad\u30fc\u300d\u306e\u6a2a\u306b\u524a\u9664\u3057\u305f\u3044\u30ad\u30fc\u30ef\u30fc\u30c9\u3092\u5165\u308c\u3066\uff0c\u524a\u9664\u30dc\u30bf\u30f3\u3092\u62bc\u3059\u3068\uff0c\u305d\u306e\u30ad\u30fc\u3068\u5024\u304c\u524a\u9664\u3055\u308c\u307e\u3059\uff0e<\/p>\n<p>\u306a\u304a\uff0c\u540c\u3058\u30ad\u30fc\u306e\u5834\u5408\u306f\uff0c\u4e0a\u66f8\u304d\u3055\u308c\u307e\u3059\u306e\u3067\uff0c\u65e5\u4ed8\u306a\u3069\u3067\u56fa\u6709\u5316\u3055\u305b\u3066\u304f\u3060\u3055\u3044\uff0e<\/p>\n<p>\u4f8b\u3048\u3070\uff0c\u300c2014\u5e7411\u6708\u96fb\u6c17\u4ee3\u300d\u3068\u3044\u3046\u98a8\u306b\uff0e<\/p>\n<p>\u914d\u5217\u306b\u5165\u308c\u3066\u3044\u308b\u306e\u3067\u4e26\u3073\u66ff\u3048\u53ef\u80fd\u304b\u3068\u601d\u308f\u308c\u307e\u3059\u304c\uff08\u30bd\u30fc\u30c8\uff09\u305d\u306e\u5834\u5408\u306f\u914d\u5217\u3078\u306e\u66f8\u304d\u8fbc\u307f\u65b9\u6cd5\u3092\u5909\u66f4\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\u304b\u3082\uff0e<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u3053\u306e\u30b5\u30f3\u30d7\u30eb\u3092\u5c11\u3057\u6539\u9020\u3057\u3066\u3044\u307e\u3059\uff0e &lt;!DOCTYPE html&gt; &lt;html lang=&#8221;ja&#8221;&gt; &lt;head&gt; &lt;meta charset=utf-8&gt; &lt;sc &hellip; <a href=\"https:\/\/nantoka.filmm.info\/blog\/?p=494\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">\u30d6\u30e9\u30a6\u30b6\u306b\u30c7\u30fc\u30bf\u3092\u4fdd\u5b58\u3067\u304d\u308bwebstorage\u306e\u30b5\u30f3\u30d7\u30eb<\/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-494","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\/494","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=494"}],"version-history":[{"count":5,"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=\/wp\/v2\/posts\/494\/revisions"}],"predecessor-version":[{"id":499,"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=\/wp\/v2\/posts\/494\/revisions\/499"}],"wp:attachment":[{"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=494"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=494"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nantoka.filmm.info\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=494"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}