<?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>Ninja CSS Blog &#187; javascript</title>
	<atom:link href="http://ninjacss.com/blog/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://ninjacss.com/blog</link>
	<description>html, css, javascript &#38; other stuff</description>
	<lastBuildDate>Thu, 25 Aug 2011 14:29:48 +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>Javascript &#8211; Toggle Visibility</title>
		<link>http://ninjacss.com/blog/2011/08/25/javascript-toggle-visibility/</link>
		<comments>http://ninjacss.com/blog/2011/08/25/javascript-toggle-visibility/#comments</comments>
		<pubDate>Thu, 25 Aug 2011 14:26:47 +0000</pubDate>
		<dc:creator>Cindy</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[hide]]></category>
		<category><![CDATA[show]]></category>
		<category><![CDATA[show/hide]]></category>
		<category><![CDATA[toggle]]></category>
		<category><![CDATA[toggle visibility]]></category>
		<category><![CDATA[visibility]]></category>

		<guid isPermaLink="false">http://ninjacss.com/blog/?p=198</guid>
		<description><![CDATA[Javascript code: HTML: This is the a question. This is an answer. Example: Please click here. Congrats! You have toggled the visibility of this content.]]></description>
			<content:encoded><![CDATA[<p>Javascript code:</p>
<pre class="brush: javascript">
<script type="text/javascript">
    function toggle_visibility(id) {
       var e = document.getElementById(id);
       if(e.style.display == 'block')
          e.style.display = 'none';
       else
          e.style.display = 'block';
    }
</script></pre>
<p>HTML:</p>
<pre class="brush: html"><a onclick="toggle_visibility('answer');" href="#">This is the a question.</a>
<div id="answer" style="display: none;">This is an answer.</div>
</pre>
<p>Example:<br />
<a onclick="toggle_visibility('answer');" href="#">Please click here.</a></p>
<div id="answer" style="display: none;">Congrats! You have toggled the visibility of this content.</div>
]]></content:encoded>
			<wfw:commentRss>http://ninjacss.com/blog/2011/08/25/javascript-toggle-visibility/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Javascript &#8211; image swap and preload</title>
		<link>http://ninjacss.com/blog/2009/06/30/javascript-image-swap-and-preload/</link>
		<comments>http://ninjacss.com/blog/2009/06/30/javascript-image-swap-and-preload/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 12:47:00 +0000</pubDate>
		<dc:creator>Cindy</dc:creator>
				<category><![CDATA[javascript]]></category>
		<category><![CDATA[image swap]]></category>

		<guid isPermaLink="false">http://ninjacss.com/blog/?p=5</guid>
		<description><![CDATA[What You Want To Do: you have a menu of items or a set of images that need to change when they are hovered over. How To Do It: Use the MM Image Swap! Put the following code between the &#60;head&#62; tags or a Javascript file that is called on whichever page(s) you want to [...]]]></description>
			<content:encoded><![CDATA[<p>What You Want To Do: you have a menu of items or a set of images that need to change when they are hovered over. </p>
<p>How To Do It: Use the MM Image Swap!</p>
<p>Put the following code between the &lt;head&gt; tags or a Javascript file that is called on whichever page(s) you want to swap images on.</p>
<pre class="brush: js">
<script type="text/javascript">
function MM_preloadImages() {
  var d=document; if(d.images){ 
    if (!d.MM_p) d.MM_p=new Array();
    var i, j = d.MM_p.length, a = MM_preloadImages.arguments; for(i = 0; i < a.length; i++)
    if (a[i].indexOf("#")!= 0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i]; } }
}

function MM_swapImgRestore() {
  var i, x, a = document.MM_sr; for(i = 0; a &&amp; i <a.length &&amp; (x = a[i])&&amp;x.oSrc; i++) x.src=x.oSrc;
}

function MM_swapImage() {
  var i, j = 0, x, a = MM_swapImage.arguments; document.MM_sr=new Array; for(i = 0; i < (a.length-2); i += 3)
   if ((x=MM_findObj(a[i])) != null){document.MM_sr[j++] = x; if(!x.oSrc) x.oSrc=x.src; x.src= a [i+2]; }
}

function MM_findObj(n, d) {
  var p, i, x;  if(!d) d = document; 
  if ((p = n.indexOf("?")) > 0 &&amp; parent.frames.length) {
    d = parent.frames[n.substring(p + 1)].document; n = n.substring(0, p);}
  if(!(x=d[n]) &&amp; d.all) x = d.all[n]; for (i = 0; !x &&amp; i < d.forms.length; i++) x = d.forms[i][n];
  for(i = 0; !x &&amp; d.layers &&amp; i < d.layers.length; i++) x=MM_findObj(n, d.layers[i].document);
  if(!x &&amp; d.getElementById) x=d.getElementById(n); return x;
}
</script>
</pre>
<p>Now, for the section that has the menu items (or images) that you want to swap, you  need to call the functions. The example I'm going to give is the menu list I used, so  adjust accordingly. If you didn't use a &lt;ul&gt; list, then don't copy my code exactly. Also, you'll need to swap out the image file names, height and width, etc. to your own.</p>
<pre class="brush: js">
<ul>
<li><a href="page1.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('image1','','home_on.jpg',1)"><img name="home" src="home.jpg" width="47" height="15" border="0" alt="Home"></a></li>
<li><a href="page2.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('createMap','','createMap_on.jpg',1)"><img src="createMap.jpg" width="95" height="15" border="0" name="createMap" alt="Create Map"></a></li>
<li><a href="page3.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('createTable','','createTable_on.jpg',1)"><img src="createTable.jpg" width="102" height="15" border="0" name="createTable" alt="Create Table"></a></li>
<li><a href="page4.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('dataDownloads','','dataDownloads_on.jpg',1)"><img src="dataDownloads.jpg" width="116" height="15" border="0" name="dataDownloads" alt="Data Downloads"></a></li>
<li><a href="page5.html" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('researchFindings','','researchFindings_on.jpg',1)"><img src="/researchFindings.jpg" width="114" height="15" border="0" name="researchFindings" alt="Research Findings"></a></li>
</ul>
</pre>
<p>Finally, go to the &lt;body&gt; tag and preload the images. Again, change the image file names to your own.</p>
<pre class="brush: js">
&lt;body onLoad="MM_preloadImages('home.jpg', 'home_on.jpg', 'createMap.jpg', 'createMap_on.jpg', 'createTable.jpg', 'createTable_on.jpg', 'dataDownloads.jpg', 'dataDownloads_on.jpg', 'researchFindings.jpg', 'researchFindings_on.jpg')"&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://ninjacss.com/blog/2009/06/30/javascript-image-swap-and-preload/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Served from: ninjacss.com @ 2012-02-06 06:47:59 -->
