<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>TangoRangers.com&#039;s Blog &#187; div</title>
	<atom:link href="http://blog.tangorangers.com/tag/div/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.tangorangers.com</link>
	<description>Misc crap and such</description>
	<lastBuildDate>Wed, 18 Jan 2012 02:26:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Using Javascript to hide single/multiple div tags with the same name Part 2</title>
		<link>http://blog.tangorangers.com/2009/08/using-javascript-to-hide-singlemultiple-div-tags-with-the-same-name-part-2/</link>
		<comments>http://blog.tangorangers.com/2009/08/using-javascript-to-hide-singlemultiple-div-tags-with-the-same-name-part-2/#comments</comments>
		<pubDate>Fri, 14 Aug 2009 23:36:19 +0000</pubDate>
		<dc:creator>DaijoubuKun</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[div]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://blog.tangorangers.com/?p=194</guid>
		<description><![CDATA[Recently I was asked by a comment from my previous post Using Javascript to hide single/multiple div tags with the same name on how to get multiple buttons to control multiple div tags. For example, 2 div classes need to be hidden or shown with 2 different buttons controlling them. Turns out this is fairly [...]]]></description>
			<content:encoded><![CDATA[<p>Recently I was asked by a comment from my previous post <a href="http://blog.tangorangers.com/2009/03/using-javascript-to-hide-singlemultiple-div-tags-with-the-same-name/">Using Javascript to hide single/multiple div tags with the same name</a> on how to get multiple buttons to control multiple div tags. For example, 2 div classes need to be hidden or shown with 2 different buttons controlling them. Turns out this is fairly simple. Basically you can use some previous code and alter some variable names in the javascript, but to make things simple here is the code.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> getElementsByClass<span style="color: #009900;">&#40;</span>searchClass<span style="color: #339933;">,</span> domNode<span style="color: #339933;">,</span> tagName<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>domNode <span style="color: #339933;">==</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> domNode <span style="color: #339933;">=</span> document<span style="color: #339933;">;</span>
     <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>tagName <span style="color: #339933;">==</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> tagName <span style="color: #339933;">=</span> <span style="color: #3366CC;">'*'</span><span style="color: #339933;">;</span>
     <span style="color: #003366; font-weight: bold;">var</span> el <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Array<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #003366; font-weight: bold;">var</span> tags <span style="color: #339933;">=</span> domNode.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span>tagName<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #003366; font-weight: bold;">var</span> tcl <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot; &quot;</span><span style="color: #339933;">+</span>searchClass<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot; &quot;</span><span style="color: #339933;">;</span>
     <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span>j<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i<span style="color: #339933;">&lt;</span>tags.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          <span style="color: #003366; font-weight: bold;">var</span> test <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot; &quot;</span> <span style="color: #339933;">+</span> tags<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">className</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot; &quot;</span><span style="color: #339933;">;</span>
          <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>test.<span style="color: #660066;">indexOf</span><span style="color: #009900;">&#40;</span>tcl<span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span>
               el<span style="color: #009900;">&#91;</span>j<span style="color: #339933;">++</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> tags<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
          <span style="color: #009900;">&#125;</span>
     <span style="color: #000066; font-weight: bold;">return</span> el<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> hidden <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">function</span> toggle_hideme1<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     hidden <span style="color: #339933;">=</span> <span style="color: #339933;">!</span>hidden<span style="color: #339933;">;</span>
     <span style="color: #003366; font-weight: bold;">var</span> newDisplay<span style="color: #339933;">;</span>
     <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>hidden<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          newDisplay <span style="color: #339933;">=</span> <span style="color: #3366CC;">'block'</span><span style="color: #339933;">;</span>
     <span style="color: #009900;">&#125;</span>
     <span style="color: #000066; font-weight: bold;">else</span>
     <span style="color: #009900;">&#123;</span>
          newDisplay <span style="color: #339933;">=</span> <span style="color: #3366CC;">'none'</span><span style="color: #339933;">;</span>
     <span style="color: #009900;">&#125;</span>
     <span style="color: #003366; font-weight: bold;">var</span> showfirst <span style="color: #339933;">=</span> getElementsByClass<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div_class_name&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;div&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> showfirst.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          showfirst<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">style</span>.<span style="color: #660066;">display</span> <span style="color: #339933;">=</span> newDisplay<span style="color: #339933;">;</span>
     <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> hiddenb <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">function</span> toggle_hideme2<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     hiddenb <span style="color: #339933;">=</span> <span style="color: #339933;">!</span>hiddenb<span style="color: #339933;">;</span>
     <span style="color: #003366; font-weight: bold;">var</span> newDisplay<span style="color: #339933;">;</span>
     <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>hiddenb<span style="color: #009900;">&#41;</span>
     <span style="color: #009900;">&#123;</span>
          newDisplay <span style="color: #339933;">=</span> <span style="color: #3366CC;">'block'</span><span style="color: #339933;">;</span>
     <span style="color: #009900;">&#125;</span>
     <span style="color: #000066; font-weight: bold;">else</span>
     <span style="color: #009900;">&#123;</span>
          newDisplay <span style="color: #339933;">=</span> <span style="color: #3366CC;">'none'</span><span style="color: #339933;">;</span>
     <span style="color: #009900;">&#125;</span>
     <span style="color: #003366; font-weight: bold;">var</span> showsecond <span style="color: #339933;">=</span> getElementsByClass<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div_class_name&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;div&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
     <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> k <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> k <span style="color: #339933;">&lt;</span> showsecond.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> k<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          showsecond<span style="color: #009900;">&#91;</span>k<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">style</span>.<span style="color: #660066;">display</span> <span style="color: #339933;">=</span> newDisplay<span style="color: #339933;">;</span>
     <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>For the variables &#8216;showfirst&#8217; and &#8216;showsecond&#8217; you can call them what ever you want, just make sure they stay the same in only one function, not two. Be sure to change &#8216;div_class_name&#8217; to a custom name for each field.</p>
<p>Also, these are setup to be hidden first, you can change that by swapping the &#8216;newDisplay = &#8216; lines.</p>
<p>For the HTML code we are going to use check boxes. We need two boxes each with names that call the function.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;input type=&quot;checkbox&quot; name=&quot;showone&quot; id=&quot;showone&quot; value=&quot;showone&quot; onClick=&quot;toggle_hideme1('showone');&quot;&gt;&lt;br /&gt;
&lt;input type=&quot;checkbox&quot; name=&quot;showtwo&quot; id=&quot;showtwo&quot; value=&quot;showtwo&quot; onClick=&quot;toggle_hideme2('showtwo');&quot;&gt;&lt;br /&gt;</pre></div></div>

<p>If you want the boxes checked to start first swap the &#8216;newDisplay =&#8217; lines, and use this.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;input type=&quot;checkbox&quot; name=&quot;showone&quot; id=&quot;showone&quot; value=&quot;showone&quot; onClick=&quot;toggle_hideme1('showone');&quot; CHECKED&gt;&lt;br /&gt;</pre></div></div>

<p>As in my previous post you need to put what ever will be shown or hidden in a div class tag.</p>

<div class="wp_syntax"><div class="code"><pre class="html" style="font-family:monospace;">&lt;div class=&quot;div_class_name&quot; style=&quot;display: none;&quot;&gt;</pre></div></div>

<p>The style hides everything in the class until the box is checked.</p>
<p>That will start the boxed checked, when you un-check it the data in all div classes with that name will hide (remember the &#8216;div_class_name&#8217;? that&#8217;s what we are working with).</p>
<p>I wrote this up in just a couple minutes, so I truly help it makes scene. You can check out an example of how it works <a href="http://www.tangorangers.com/examples/jshidedivs_part2/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tangorangers.com/2009/08/using-javascript-to-hide-singlemultiple-div-tags-with-the-same-name-part-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Using Javascript to hide single/multiple div tags with the same name</title>
		<link>http://blog.tangorangers.com/2009/03/using-javascript-to-hide-singlemultiple-div-tags-with-the-same-name/</link>
		<comments>http://blog.tangorangers.com/2009/03/using-javascript-to-hide-singlemultiple-div-tags-with-the-same-name/#comments</comments>
		<pubDate>Sun, 08 Mar 2009 16:49:39 +0000</pubDate>
		<dc:creator>DaijoubuKun</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[div]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://blog.tangorangers.com/?p=104</guid>
		<description><![CDATA[Update (March 25th, 2009): I have created a page on the main site so that you can see how the code works, it may be easier to read than this. Check it out here After scouring the net for information I finally got my answer from JimmySeal at TechGuy.org. Turns out the process is very [...]]]></description>
			<content:encoded><![CDATA[<p>Update (March 25th, 2009):<br />
I have created a page on the main site so that you can see how the code works, it may be easier to read than this.  Check it out <a href="http://www.tangorangers.com/examples/jshidedivs/">here</a></p>
<p>After scouring the net for information I finally got my answer from JimmySeal at <a href="http://forums.techguy.org">TechGuy.org</a>.  Turns out the process is very simple.</p>
<p>In my first example I want to hide just one div tag when a check box is clicked. The process is a simple one, all we need to do is create a div with an id argument.  Like <em>div id=&#8221;hideme&#8221;</em>.  I prefer to use external js files to hold my javascript functions.  Lets call it <em>junctions.js</em>.  In this file lets put this bit of code.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> toggle_visibility<span style="color: #009900;">&#40;</span>hideme<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #003366; font-weight: bold;">var</span> e <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span>hideme<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>e.<span style="color: #660066;">style</span>.<span style="color: #660066;">display</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">'block'</span><span style="color: #009900;">&#41;</span>
		e.<span style="color: #660066;">style</span>.<span style="color: #660066;">display</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'none'</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">else</span>
		e.<span style="color: #660066;">style</span>.<span style="color: #660066;">display</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">'block'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>This will hide the div tag with id <em>hideme</em><br />
So in my html file I have something like this.  (My example is in an input form)</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>b<span style="color: #339933;">&gt;</span>Show the field<span style="color: #339933;">&lt;/</span>b<span style="color: #339933;">&gt;&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;checkbox&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;a_name&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;a_name&quot;</span> onClick<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;toggle_visibility('hideme');&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;hideme&quot;</span> style<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;display:block;&quot;</span><span style="color: #339933;">&gt;</span>
	<span style="color: #339933;">&lt;</span>b<span style="color: #339933;">&gt;</span>was hidden<span style="color: #339933;">&lt;/</span>b<span style="color: #339933;">&gt;&lt;</span>textarea name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;some_name&quot;</span> cols<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;40&quot;</span> rows<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;5&quot;</span><span style="color: #339933;">&gt;&lt;/</span>textarea<span style="color: #339933;">&gt;&lt;</span>br <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span></pre></div></div>

<p>Notice that the div id and the onClick functions are the same name, <em>hideme</em>.  That&#8217;s it!  How when the box is checked it will hide that one div tag.</p>
<p>What if you want to hide multiple div tags.  Unfortunately the above script will not work simply because you can&#8217;t have more than one div id per page.  You must use <strong>div class</strong>.</p>
<p>Open up your functions.js file and put this in.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> hidden <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #003366; font-weight: bold;">function</span> getElementsByClass<span style="color: #009900;">&#40;</span>searchClass<span style="color: #339933;">,</span> domNode<span style="color: #339933;">,</span> tagName<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>domNode <span style="color: #339933;">==</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> domNode <span style="color: #339933;">=</span> document<span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>tagName <span style="color: #339933;">==</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #009900;">&#41;</span> tagName <span style="color: #339933;">=</span> <span style="color: #3366CC;">'*'</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> el <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> Array<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> tags <span style="color: #339933;">=</span> domNode.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span>tagName<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> tcl <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot; &quot;</span><span style="color: #339933;">+</span>searchClass<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot; &quot;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span>j<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i<span style="color: #339933;">&lt;</span>tags.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #003366; font-weight: bold;">var</span> test <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot; &quot;</span> <span style="color: #339933;">+</span> tags<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">className</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">&quot; &quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>test.<span style="color: #660066;">indexOf</span><span style="color: #009900;">&#40;</span>tcl<span style="color: #009900;">&#41;</span> <span style="color: #339933;">!=</span> <span style="color: #339933;">-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span>
		el<span style="color: #009900;">&#91;</span>j<span style="color: #339933;">++</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> tags<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">return</span> el<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> toggle_hideme<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	hidden <span style="color: #339933;">=</span> <span style="color: #339933;">!</span>hidden<span style="color: #339933;">;</span>
	<span style="color: #003366; font-weight: bold;">var</span> newDisplay<span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>hidden<span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		newDisplay <span style="color: #339933;">=</span> <span style="color: #3366CC;">'none'</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #000066; font-weight: bold;">else</span>
	<span style="color: #009900;">&#123;</span>
		newDisplay <span style="color: #339933;">=</span> <span style="color: #3366CC;">'block'</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #003366; font-weight: bold;">var</span> hellos <span style="color: #339933;">=</span> getElementsByClass<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;div_class_name&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;div&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i <span style="color: #339933;">&lt;</span> hellos.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		hellos<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">style</span>.<span style="color: #660066;">display</span> <span style="color: #339933;">=</span> newDisplay<span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>Now for the form code example</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;checkbox&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;a_name&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;a_name&quot;</span> onClick<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;toggle_hideme('div_class_name');&quot;</span><span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;div_class_name&quot;</span><span style="color: #339933;">&gt;</span>
	Blah Blah Blah
<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;something_else&quot;</span><span style="color: #339933;">&gt;</span>
	What ever is here will not disappear<span style="color: #339933;">!</span>
<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;div_class_name&quot;</span><span style="color: #339933;">&gt;</span>
	more blah blah blah
<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span></pre></div></div>

<p>The only thing you need to pay attention to here is <em>div_class_name</em> just change it to what ever you want to call your div tag.</p>
<p>EDIT NOTE:<br />
I just want to say that I&#8217;ve been getting a lot of hits here, but no one leaves me any comments. How do I know if this is helpful?  Please leave a comment.  I won&#8217;t sell your e-mails or anything.  If you so desire enter in a fake e-mail, I don&#8217;t care.  I just want to know.  Thank you.</p>
<p>UPDATE!<br />
<a href="http://blog.tangorangers.com/2009/08/using-javascript-to-hide-singlemultiple-div-tags-with-the-same-name-part-2/">http://blog.tangorangers.com/2009/08/using-javascript-to-hide-singlemultiple-div-tags-with-the-same-name-part-2/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.tangorangers.com/2009/03/using-javascript-to-hide-singlemultiple-div-tags-with-the-same-name/feed/</wfw:commentRss>
		<slash:comments>16</slash:comments>
		</item>
	</channel>
</rss>

