<?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>Victorelu &#187; javascript</title>
	<atom:link href="http://victorelu.com/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://victorelu.com</link>
	<description>Romanian studying in Aarhus</description>
	<lastBuildDate>Wed, 30 Jun 2010 21:33:29 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Tutorial: hide DIV with Javascript</title>
		<link>http://victorelu.com/tutorial-hide-div-with-javascript/</link>
		<comments>http://victorelu.com/tutorial-hide-div-with-javascript/#comments</comments>
		<pubDate>Fri, 10 Apr 2009 10:54:48 +0000</pubDate>
		<dc:creator>Victor</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[tutorial]]></category>

		<guid isPermaLink="false">http://victorelu.com/?p=12</guid>
		<description><![CDATA[Ok, so I am giong to show you the easiest way to hide a DIV with Javascript. The effect is nice if you tweak it a little bit and this is just to be going you on with.
I am going to write the code of the page here and then I will explain the important [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, so I am giong to show you the easiest way to hide a DIV with Javascript. The effect is nice if you tweak it a little bit and this is just to be going you on with.</p>
<p>I am going to write the code of the page here and then I will explain the important actions which take place. It is not the best html code ever but as I said, this is not important.</p>
<pre>    &lt;html&gt;
    &lt;head&gt;
    &lt;script type="text/javascript"&gt;

    function hidediv()
    { document.getElementById("mydiv").style.display="none"; }
    function showdiv()
    { document.getElementById("mydiv").style.display="block"; }

    &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
    &lt;div id="mydiv"&gt;This is the text that hides or shows&lt;/div&gt;
    &lt;input type="submit" value="Hide!" onclick="hidediv()"&gt;
    &lt;input type="submit" value="Show!" onclick="showdiv()"&gt;
    &lt;/body&gt;
    &lt;/html&gt;</pre>
<p>Ok, so it wasn&#8217;t that hard, was it? Maybe the thing that looks the hardest is the javascript code located in the head section of the html code but then again, let&#8217;s check it out:</p>
<pre>function hidediv()
    { document.getElementById("mydiv").style.display="none"; }</pre>
<p>Alright so, <em>hidediv()</em> is the name of the function and the next line is self explanatory. <em>document.getElementById(&#8221;mydiv&#8221;).style.display=&#8221;none&#8221;</em> does exactly what it says: it searches the document for the element with the id &#8220;mydiv&#8221; and sets it&#8217;s display style to none. Take care because <em>getElementById</em> is case sensitive!</p>
<p>All we have to do next is to call the function on the click of the button&#8221;&lt;input type=&#8221;submit&#8221; value=&#8221;Hide!&#8221; onclick=&#8221;<em>hidediv()</em>&#8220;&gt; and our DIV hiding is done. Hope this will help! <img src='http://victorelu.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  For a demo, click <a href="http://victorelu.com/tutorials/hidediv.htm" target="_blank">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://victorelu.com/tutorial-hide-div-with-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
