{"id":2121,"date":"2004-01-11T06:33:54","date_gmt":"2004-01-11T22:33:54","guid":{"rendered":"http:\/\/michaelhans.com\/eclecticism\/2004\/01\/11\/javascript-toggle-code\/"},"modified":"2019-12-09T15:06:09","modified_gmt":"2019-12-09T23:06:09","slug":"javascript-toggle-code","status":"publish","type":"post","link":"https:\/\/michaelhans.com\/eclecticism\/2004\/01\/11\/javascript-toggle-code\/","title":{"rendered":"JavaScript toggle code"},"content":{"rendered":"<div class='__iawmlf-post-loop-links' style='display:none;' data-iawmlf-post-links='[{&quot;id&quot;:12376,&quot;href&quot;:&quot;http:\\\/\\\/blog.liquidvolt.com\\\/typepad\\\/viewtopic.php?t=656&quot;,&quot;archived_href&quot;:&quot;&quot;,&quot;redirect_href&quot;:&quot;&quot;,&quot;checks&quot;:[],&quot;broken&quot;:false,&quot;last_checked&quot;:null,&quot;process&quot;:&quot;done&quot;}]'><\/div>\n<p>I&#8217;m just saving this for myself for future design possibilities&#8230; The script that goes in the <code>head<\/code>:<\/p>\n<pre><code>&lt;script type=\"text\/javascript\"&gt;\n&lt;!-- \n\/\/ toggle visibility \n\nfunction toggle( targetId ){ \n  if (document.getElementById){ \n        target = document.getElementById( targetId ); \n           if (target.style.display == \"none\"){ \n              target.style.display = \"\"; \n           } else { \n              target.style.display = \"none\"; \n           } \n     } \n} \n--&gt;\n&lt;\/script&gt;\n<\/code><\/pre>\n<p>Sample code showing usage:<\/p>\n<pre><code>&lt;h3&gt;Blogs I Read &lt;a href=\"#\" onclick=\"toggle('outside2');return false;\" title=\"Toggle BlogRoll\"&gt;(show\/hide)&lt;\/a&gt;&lt;\/h3&gt; \n\n    &lt;div id=\"outside2\"&gt; \n        &lt;h1&gt;&lt;a href=\"http:\/\/www.google.com\" title=\"google.\"&gt;Google Search&lt;\/a&gt;&lt;br \/&gt; \n        &lt;a href=\"http:\/\/www.google.com\" title=\"google.\"&gt;Google Search&lt;\/a&gt;&lt;\/h1&gt; \n        &lt;div class=\"dailyphoto\"&gt;&lt;!--#include virtual=\"\/daily\/dailyphoto.inc\"--&gt;&lt;\/div&gt; \n  &lt;\/div&gt; \n\n&lt;h3&gt;Blogs I Read &lt;a href=\"#\" onclick=\"toggle('outside3');return false;\" title=\"Toggle BlogRoll\"&gt;(show\/hide)&lt;\/a&gt;&lt;\/h3&gt; \n\n    &lt;div id=\"outside3\"&gt; \n        &lt;h1&gt;&lt;a href=\"http:\/\/www.google.com\" title=\"google.\"&gt;Google Search&lt;\/a&gt;&lt;br \/&gt; \n        &lt;a href=\"http:\/\/www.google.com\" title=\"google.\"&gt;Google Search&lt;\/a&gt;&lt;\/h1&gt; \n        &lt;div class=\"dailyphoto\"&gt;&lt;!--#include virtual=\"\/daily\/dailyphoto.inc\"--&gt;&lt;\/div&gt; \n  &lt;\/div&gt;&lt;\/div&gt;\n<\/code><\/pre>\n<p>(via <a href=\"http:\/\/blog.liquidvolt.com\/typepad\/viewtopic.php?t=656\" title=\"Javascript Visbitlity toggle\">Joel Blain<\/a>)<\/p>\n<p><strong>iTunes:<\/strong> &#8220;World, The&#8221; by Quest from the album <em>Essential Chillout<\/em> (2000, 4:17).<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m just saving this for myself for future design possibilities&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2040],"tags":[25],"class_list":["post-2121","post","type-post","status-publish","format-standard","hentry","category-blog","tag-website"],"_links":{"self":[{"href":"https:\/\/michaelhans.com\/eclecticism\/wp-json\/wp\/v2\/posts\/2121","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/michaelhans.com\/eclecticism\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/michaelhans.com\/eclecticism\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/michaelhans.com\/eclecticism\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/michaelhans.com\/eclecticism\/wp-json\/wp\/v2\/comments?post=2121"}],"version-history":[{"count":0,"href":"https:\/\/michaelhans.com\/eclecticism\/wp-json\/wp\/v2\/posts\/2121\/revisions"}],"wp:attachment":[{"href":"https:\/\/michaelhans.com\/eclecticism\/wp-json\/wp\/v2\/media?parent=2121"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/michaelhans.com\/eclecticism\/wp-json\/wp\/v2\/categories?post=2121"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/michaelhans.com\/eclecticism\/wp-json\/wp\/v2\/tags?post=2121"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}