{"id":880,"date":"2010-01-05T23:59:36","date_gmt":"2010-01-05T22:59:36","guid":{"rendered":"http:\/\/blogg.ngn.nu\/index.php\/2010\/01\/05\/trettondagsafton\/"},"modified":"2010-01-06T00:11:39","modified_gmt":"2010-01-05T23:11:39","slug":"trettondagsafton","status":"publish","type":"post","link":"https:\/\/blogg.ngn.nu\/index.php\/2010\/01\/05\/trettondagsafton\/","title":{"rendered":"Trettondagsafton"},"content":{"rendered":"<p>s\u00f6mn, helt ok<\/p>\n<p><strong>Programmering<\/strong><br \/>\nG\u00e5rdagens hj\u00e4rnkn\u00e4ck visade sig vara ett ordentligt hj\u00e4rnsl\u00e4pp. Eller inte. Kanske mer en k\u00e4nga \u00e5t olika programmerares of\u00f6rm\u00e5ga att t\u00e4nka &#8217;enklare&#8217;.<\/p>\n<p>Det som bl.a. satte krokben f\u00f6r mig var f\u00f6ljande;<br \/>\n<font face=\"Courier New, Courier, monospace\">Fel: \u00a0TextAreaMe.Value<br \/>\nR\u00e4tt:<\/font><font face=\"Courier New, Courier, monospace\">\u00a0TextAreaMe.value<\/font><br \/>\nSer Ni skillnaden?<\/p>\n<p>Klart att Ni g\u00f6r n\u00e4r det blir uppst\u00e4llt p\u00e5 det viset. I en JavaScriptKod med ca 1321 tecken blir det knepigare.<\/p>\n<p>S\u00e5h\u00e4r ser det ut (Mina f\u00e4rgmarkeringar, grovt \u00e4r; <font color=\"#009900\">gr\u00f6nt<\/font>, <font color=\"red\">r\u00f6tt<\/font>, <font color=\"#993399\">m\u00f6rklila<\/font>, <font color=\"#cc66cc\">lila<\/font>,\u00a0<font color=\"#9999ff\">ljusbl\u00e5tt<\/font>, <font color=\"#33ccff\">turkos<\/font> och svart HTML samt; <font color=\"#990000\">brunt<\/font>, <font color=\"red\">r\u00f6tt<\/font>, <font color=\"#ff6666\">ljusr\u00f6tt<\/font>, <font color=\"#cc66cc\">lila<\/font>, <font color=\"#3333ff\">bl\u00e5tt<\/font>, <font color=\"#9999ff\">ljusbl\u00e5tt<\/font>, <font color=\"#999999\">gr\u00e5tt<\/font> och svart JavaScript):<br \/>\n<strong> <\/strong><\/p>\n<pre style=\"background: white none repeat scroll 0% 50%; overflow: auto; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial; width: 440px; height: 144px\"><strong><font face=\"Courier New, Courier, monospace\"><font color=\"#993399\"><font color=\"#009900\">&lt;!DOCTYPE<\/font> html PUBLIC<\/font> <font color=\"#cc66cc\"><font color=\"black\">\"<\/font>-\/\/W3C\/\/DTD HTML 4.01\/\/EN<font color=\"black\">\"<\/font> \"http:\/\/www.w3.org\/TR\/html4\/strict.dtd<font color=\"black\">\"<\/font><\/font><font color=\"#009900\">&gt;<\/font>\r\n<font color=\"#009900\">&lt;html<\/font> <font color=\"#9999ff\">lang<font color=\"red\">=<\/font><\/font><font color=\"#cc66cc\"><font color=\"black\">\"<\/font><font color=\"#33ccff\">sv<\/font><font color=\"black\">\"<\/font><\/font><font color=\"#009900\">&gt;<\/font>\r\n<font color=\"#009900\">&lt;head&gt;\r\n&lt;meta<\/font> <font color=\"#9999ff\">content<font color=\"red\">=<\/font><\/font><font color=\"#cc66cc\"><font color=\"black\">\"<\/font><font color=\"#33ccff\">text\/html<\/font><font color=\"black\">\"<\/font><\/font> <font color=\"#9999ff\">charset<font color=\"red\">=<\/font><\/font><font color=\"#cc66cc\"><font color=\"black\">\"<\/font><font color=\"#33ccff\">UTF-8<\/font><font color=\"black\">\"<\/font><\/font> <font color=\"#9999ff\">http-equiv<font color=\"red\">=<\/font><\/font><font color=\"#cc66cc\"><font color=\"black\">\"<\/font><font color=\"#33ccff\">content-type<\/font><font color=\"black\">\"<\/font><\/font><font color=\"#009900\">&gt;<\/font>\r\n<font color=\"#009900\">&lt;meta<\/font> <font color=\"#9999ff\">content<font color=\"red\">=<\/font><\/font><font color=\"#cc66cc\"><font color=\"black\">\"<\/font>NGN<font color=\"black\">\"<\/font><\/font> <font color=\"#9999ff\">name<font color=\"red\">=<\/font><\/font><font color=\"#cc66cc\"><font color=\"black\">\"<\/font>author<font color=\"black\">\"<\/font><\/font><font color=\"#009900\">&gt;<\/font>\r\n<font color=\"#009900\">&lt;title&gt;&lt;\/title&gt;\r\n&lt;script&gt;<\/font>\r\n<font color=\"#990000\">function<\/font> <font color=\"#999999\">ifEnter<\/font>(<font color=\"#999999\">f<\/font>,<font color=\"#999999\">e<\/font>) {\r\n<font color=\"#990000\"> var<\/font> <font color=\"#999999\">theKeyCode<\/font> <font color=\"red\">=<\/font> <font color=\"#999999\">e<\/font>.<font color=\"#990000\">keyCode<\/font> <font color=\"red\">?<\/font> <font color=\"#999999\">e<\/font>.<font color=\"#990000\">keyCode<\/font> <font color=\"red\">:<\/font> <font color=\"#999999\">e<\/font>.<font color=\"#990000\">which<\/font> <font color=\"red\">?<\/font> <font color=\"#999999\">e<\/font>.<font color=\"#990000\">which<\/font> <font color=\"red\">:<\/font> <font color=\"#999999\">e<\/font>.<font color=\"#990000\">charCode<\/font>;\r\n<font color=\"#990000\"> if<\/font> (<font color=\"#999999\">theKeyCode<\/font> <font color=\"red\">==<\/font> <font color=\"#cc66cc\">13<\/font>){\r\n<font color=\"#990000\">  var<\/font> <font color=\"#999999\">youString<\/font> <font color=\"red\">=<\/font> <font color=\"#999999\">f<\/font>.<font color=\"#cc66cc\">You<\/font>.<font color=\"#990000\">value<\/font>;\r\n<font color=\"#990000\">  var<\/font> <font color=\"#999999\">youStringLower<\/font> <font color=\"red\">=<\/font> <font color=\"#999999\">youString<\/font>.<font color=\"#ff6666\">toLowerCase<\/font>();\r\n<font color=\"#3333ff\">  \/\/OBS! Ett [Enter] 'h\u00e4nger' med sist i textarea-'str\u00e4ngen'<\/font>\r\n<font color=\"#990000\">  if<\/font> (<font color=\"#999999\">f<\/font>.<font color=\"#cc66cc\">You<\/font>.<font color=\"#990000\">value<\/font>.<font color=\"#990000\">length<\/font> <font color=\"red\">==<\/font> <font color=\"#cc66cc\">1<\/font> <font color=\"red\">&amp;&amp;<\/font> <font color=\"#999999\">theKeyCode<\/font> <font color=\"red\">==<\/font> <font color=\"#cc66cc\">13<\/font>){\r\n<font color=\"#999999\">   f<\/font>.<font color=\"#cc66cc\">Me<\/font>.<font color=\"#990000\">rows<\/font> <font color=\"red\">=<\/font> <font color=\"#cc66cc\">2<\/font>;\r\n<font color=\"#999999\">   f<\/font>.<font color=\"#cc66cc\">Me<\/font>.<font color=\"#990000\">value<\/font> <font color=\"red\">=<\/font> <font color=\"#cc66cc\"><font color=\"black\">\"<\/font><font color=\"black\">Du skrev: Ingenting...\"<\/font><\/font> <font color=\"red\">+<\/font> <font color=\"black\">\"<\/font><font color=\"#9999ff\">\\n\\n<\/font><font color=\"#cc66cc\"><font color=\"black\">Skriv g\u00e4rna n\u00e5got.\"<\/font><\/font>;\r\n<font color=\"#999999\">   f<\/font>.<font color=\"#cc66cc\">You<\/font>.<font color=\"#990000\">value<\/font> <font color=\"red\">=<\/font> <font color=\"black\">''<\/font>;\r\n  }<font color=\"#990000\">else if<\/font>(<font color=\"#999999\">youStringLower<\/font>.<font color=\"#ff6666\">search<\/font>(<font color=\"#cc66cc\"><font color=\"black\">\"<\/font><font color=\"black\">hej\"<\/font><\/font>) <font color=\"red\">&gt;<\/font> <font color=\"#cc66cc\">-1<\/font>){\r\n<font color=\"#999999\">   f<\/font>.<font color=\"#cc66cc\">Me<\/font>.<font color=\"#990000\">rows<\/font> <font color=\"red\">=<\/font> <font color=\"#cc66cc\">3<\/font>;\r\n<font color=\"#999999\">   f<\/font>.<font color=\"#cc66cc\">Me<\/font>.<font color=\"#990000\">value<\/font> <font color=\"red\">=<\/font> <font color=\"#cc66cc\"><font color=\"black\">\"<\/font><font color=\"black\">Du skrev: \"<\/font><\/font> <font color=\"red\">+<\/font> <font color=\"#999999\">f<\/font>.<font color=\"#cc66cc\">You<\/font>.<font color=\"#990000\">value<\/font> <font color=\"red\">+<\/font> <font color=\"#cc66cc\"><font color=\"black\">\"<\/font><font color=\"black\">Hej p\u00e5 Dig ocks\u00e5!<\/font><font color=\"#9999ff\">\\n<\/font><font color=\"black\">Skriv g\u00e4rna n\u00e5got mer.\"<\/font><\/font>;\r\n<font color=\"#999999\">   f<\/font>.<font color=\"#cc66cc\">You<\/font>.<font color=\"#990000\">value<\/font> <font color=\"red\">=<\/font> <font color=\"black\">''<\/font>;\r\n  } <font color=\"#990000\">else<\/font> {\r\n<font color=\"#999999\">   f<\/font>.<font color=\"#cc66cc\">Me<\/font>.<font color=\"#990000\">rows<\/font> <font color=\"red\">=<\/font> <font color=\"#cc66cc\">2<\/font>;\r\n<font color=\"#999999\">   f<\/font>.<font color=\"#cc66cc\">Me<\/font>.<font color=\"#990000\">value<\/font> <font color=\"red\">=<\/font> <font color=\"#cc66cc\"><font color=\"black\">\"<\/font><font color=\"black\">Du skrev: \"<\/font><\/font> <font color=\"red\">+<\/font> <font color=\"#999999\">f<\/font>.<font color=\"#cc66cc\">You<\/font>.<font color=\"#990000\">value<\/font> <font color=\"red\">+<\/font> <font color=\"black\">\"<\/font><font color=\"#9999ff\">\\n<\/font><font color=\"#cc66cc\"><font color=\"black\">Skriv g\u00e4rna n\u00e5got annat.\"<\/font><\/font>;\r\n<font color=\"#999999\">   f<\/font>.<font color=\"#cc66cc\">You<\/font>.<font color=\"#990000\">value<\/font> <font color=\"red\">=<\/font> <font color=\"black\">''<\/font>;\r\n  }\r\n }\r\n}\r\n<font color=\"#009900\">&lt;\/script&gt;\r\n&lt;\/head&gt;\r\n&lt;body&gt;\r\n&lt;form<\/font> <font color=\"#9999ff\">name<font color=\"red\">=<\/font><\/font><font color=\"#cc66cc\"><font color=\"black\">\"<\/font>formname<font color=\"black\">\"<\/font><\/font><font color=\"#009900\">&gt;<\/font>\r\n<font color=\"#009900\">&lt;textarea<\/font> <font color=\"#9999ff\">id<font color=\"red\">=<\/font><\/font><font color=\"#cc66cc\"><font color=\"black\">\"<\/font>Me<font color=\"black\">\"<\/font><\/font> <font color=\"#9999ff\">readonly<font color=\"red\">=<\/font><\/font><font color=\"#cc66cc\"><font color=\"black\">\"<\/font><font color=\"#33ccff\">readonly<\/font><font color=\"black\">\"<\/font><\/font> <font color=\"#9999ff\">onfocus<font color=\"red\">=<\/font><\/font><font color=\"#cc66cc\"><font color=\"black\">\"<\/font><font color=\"#990000\">this<font color=\"black\">.<\/font>blur<\/font><font color=\"black\">()\"<\/font><\/font> <font color=\"#9999ff\">rows<font color=\"red\">=<\/font><\/font><font color=\"#cc66cc\"><font color=\"black\">\"<\/font>2<font color=\"black\">\"<\/font><\/font> <font color=\"#9999ff\">cols<font color=\"red\">=<\/font><\/font><font color=\"#cc66cc\"><font color=\"black\">\"<\/font>40<font color=\"black\">\"<\/font><\/font><font color=\"#009900\">&gt;<\/font>Skriv n\u00e5got!<font color=\"#009900\">&lt;\/textarea&gt;&lt;br&gt;\r\n&lt;textarea<\/font> <font color=\"#9999ff\">id<font color=\"red\">=<\/font><\/font><font color=\"#cc66cc\"><font color=\"black\">\"<\/font>You<font color=\"black\">\"<\/font><\/font> <font color=\"#9999ff\">rows<font color=\"red\">=<\/font><\/font><font color=\"#cc66cc\"><font color=\"black\">\"<\/font>5<font color=\"black\">\"<\/font><\/font> <font color=\"#9999ff\">cols<font color=\"red\">=<\/font><\/font><font color=\"#cc66cc\"><font color=\"black\">\"<\/font>40<font color=\"black\">\"<\/font><\/font> <font color=\"#9999ff\">onkeyup<font color=\"red\">=<\/font><\/font><font color=\"#cc66cc\"><font color=\"black\">\"<\/font><font color=\"#990000\"><font color=\"#999999\">ifEnter<\/font><font color=\"black\">(<\/font><\/font><font color=\"#990000\">this<font color=\"black\">.<\/font>form<font color=\"black\">,<\/font>event<font color=\"black\">);<\/font><\/font><font color=\"black\">\"<\/font><\/font><font color=\"#009900\">&gt;&lt;\/textarea&gt;&lt;br&gt;<\/font>\r\n(avsluta med [Enter])<font color=\"#009900\">&lt;br&gt;\r\n&lt;\/form&gt;\r\n&lt;script&gt;<\/font>\r\n<font color=\"#990000\"> document<\/font>.<font color=\"#cc66cc\">formname<\/font>.<font color=\"#cc66cc\">You<\/font>.<font color=\"#009900\">focus<\/font>();\r\n<font color=\"#009900\">&lt;\/script&gt;\r\n&lt;\/body&gt;\r\n&lt;\/html&gt;<\/font><\/font><\/strong><\/pre>\n<p> Det ovanst\u00e5ende\u00a0HTML-sidan och JavaScript g\u00f6r \u00e4r att skapa tv\u00e5 textrutor.<br \/>\nI den \u00f6versta &#8217;skriver&#8217; programmet (programmeraren) och i den nedre skriver anv\u00e4ndaren (du).<\/p>\n<p>Detta \u00e4r allts\u00e5 embryot till mitt s.k. textspel.<\/p>\n<p>N\u00e4sta steg \u00e4r att f\u00e5 det att fungera tillsammans med php och MySQL databas.<\/p>\n<p>Min tanke \u00e4r att detta textspel ska finnas som en egen sida p\u00e5 den h\u00e4r bloggen.<\/p>\n<p>Du kan testa h\u00e4r: <a href=\"http:\/\/ngn.nu\/spel\/sjuk\/TextSpelTest.html\" target=\"_blank\">TextSpelTest<\/a><\/p>\n<p><strong>After Work<\/strong><br \/>\nHustrun och jag har\u00a0haft v\u00e5rt eget lilla privata After Work.<\/p>\n<p><strong>Bastu<\/strong><br \/>\nEfter v\u00e5r After Work tog jag mig till &#8217;g\u00e5rdsbastun&#8217; och var d\u00e4r i ganska precis 2 timmar, h\u00e4rligt!<\/p>\n<p><strong>H\u00e4lsol\u00e4get<\/strong>:<br \/>\nK\u00e4nner av en hel del ledproblem. Speciellt i fingerlederna, \u00f6veramsmusklerna och mina kn\u00e4n. Mest h\u00f6ger.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>s\u00f6mn, helt ok Programmering G\u00e5rdagens hj\u00e4rnkn\u00e4ck visade sig vara ett ordentligt hj\u00e4rnsl\u00e4pp. Eller inte. Kanske mer en k\u00e4nga \u00e5t olika programmerares of\u00f6rm\u00e5ga att t\u00e4nka &#8217;enklare&#8217;. Det som bl.a. satte krokben f\u00f6r mig var f\u00f6ljande; Fel: \u00a0TextAreaMe.Value R\u00e4tt:\u00a0TextAreaMe.value Ser Ni skillnaden? &hellip; <a href=\"https:\/\/blogg.ngn.nu\/index.php\/2010\/01\/05\/trettondagsafton\/\">Forts\u00e4tt l\u00e4sa <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[448,392],"tags":[118,200,747,311],"class_list":["post-880","post","type-post","status-publish","format-standard","hentry","category-halsa","category-programmering","tag-afterwork","tag-bastu","tag-html","tag-javascript"],"_links":{"self":[{"href":"https:\/\/blogg.ngn.nu\/index.php\/wp-json\/wp\/v2\/posts\/880","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blogg.ngn.nu\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blogg.ngn.nu\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blogg.ngn.nu\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blogg.ngn.nu\/index.php\/wp-json\/wp\/v2\/comments?post=880"}],"version-history":[{"count":0,"href":"https:\/\/blogg.ngn.nu\/index.php\/wp-json\/wp\/v2\/posts\/880\/revisions"}],"wp:attachment":[{"href":"https:\/\/blogg.ngn.nu\/index.php\/wp-json\/wp\/v2\/media?parent=880"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blogg.ngn.nu\/index.php\/wp-json\/wp\/v2\/categories?post=880"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blogg.ngn.nu\/index.php\/wp-json\/wp\/v2\/tags?post=880"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}