<?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>Web Stew &#187; Web Design</title>
	<atom:link href="http://www.gavey.ca/index.php/topics/web-design/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.gavey.ca</link>
	<description>Web development trends, techniques and demos</description>
	<lastBuildDate>Fri, 19 Mar 2010 14:56:24 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Another reason to name variables properly</title>
		<link>http://www.gavey.ca/index.php/2008/06/09/another-reason-to-name-variables-properly/</link>
		<comments>http://www.gavey.ca/index.php/2008/06/09/another-reason-to-name-variables-properly/#comments</comments>
		<pubDate>Tue, 10 Jun 2008 04:25:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Design]]></category>
		<category><![CDATA[javascript variables]]></category>

		<guid isPermaLink="false">http://www.gavey.ca/?p=4</guid>
		<description><![CDATA[I admit it, sometimes I'm just plain lazy when I write my code.  I know better but sometimes that time you just tested something in code manages to stick around a lot longer than you expected.
It happens to you too, even if you don't want to admit it.
This happened to me the other day actually, [...]]]></description>
			<content:encoded><![CDATA[<p>I admit it, sometimes I'm just plain lazy when I write my code.  I know better but sometimes that time you just tested something in code manages to stick around a lot longer than you expected.</p>
<p><strong>It happens to you too, even if you don't want to admit it.</strong></p>
<p>This happened to me the other day actually, I mistakenly named a variable in my Javascript code "status".  This as it turns out was a big mistake.  The code I wrote ran fine in Firefox but when I flipped over to Internet Explorer to test nothing was working.  After an embarrassingly long time trying to find the error there it was, and to fix it all I had to do was change the variable name.</p>
<p>So in my function I had something like:</p>
<p><strong>status=objectRef.innerHTML;</strong></p>
<p>The problem is for some unknown and seemingly unfixed reason Internet Explorer references the variable status over to the window.status object.  Window.status is the text that displays in the status area at the bottom of your browser.  So if you set the variable status to a value in side your function the status area in your browser changes as well.<br />
<span id="more-4"></span><br />
Now I could understand if this was just another IE6 browser quirk, but IE7 is affected as well. I haven't tested this on IE8 but this could be a problem here too.</p>
<p>It makes we wonder how many other keywords could be mapping to other place in the DOM.  Perhaps I will do some testing and check back in another post.  For now I will leave you with some example code, so go ahead and fire up that rusty IE6 or IE7 and I'll show you a neat trick.</p>
<pre class="javascript">&nbsp;
&lt;script&gt;
	<span style="color: #003366; font-weight: bold;">function</span> statusTest<span style="color: #66cc66;">&#40;</span><span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
		obj=document.<span style="color: #006600;">getElementById</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;mystatus&quot;</span><span style="color: #66cc66;">&#41;</span>;
		<span style="color: #000066;">status</span>=obj.<span style="color: #006600;">innerHTML</span>;
		<span style="color: #000066;">alert</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">&quot;Now look at your status bar&quot;</span><span style="color: #66cc66;">&#41;</span>;
	<span style="color: #66cc66;">&#125;</span>
&lt;/script&gt;
&nbsp;</pre>
<pre class="html4strict">&nbsp;
<span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;mystatus&quot;</span> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">'display:none'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>I shouldn't be in your status bar should I?<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span>
&nbsp;
<span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">'#'</span> <span style="color: #000066;">onclick</span>=<span style="color: #ff0000;">'statusTest();return false;'</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Prove my Point<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span>
&nbsp;</pre>
<p>Try it out...<br />
<script>
	function statusTest(){
		obj=document.getElementById("mystatus");
		status=obj.innerHTML;
		alert("Now look at your status bar");
	}
</script></p>
<div id="mystatus" style='display:none'>I shouldn't be in your status bar should I?</div>
<p><a href='#' onclick='statusTest();return false;'>Prove my Point</a></p>
<p>So lesson learned always name your variables using detailed naming conventions.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gavey.ca/index.php/2008/06/09/another-reason-to-name-variables-properly/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>I love transparencies</title>
		<link>http://www.gavey.ca/index.php/2008/06/05/i-love-transparencies/</link>
		<comments>http://www.gavey.ca/index.php/2008/06/05/i-love-transparencies/#comments</comments>
		<pubDate>Fri, 06 Jun 2008 03:52:22 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Web Design]]></category>
		<category><![CDATA[css png transparency]]></category>

		<guid isPermaLink="false">http://www.gavey.ca/?p=3</guid>
		<description><![CDATA[It's true I love transparencies, unfortunately the great minds at Microsoft did not feel the way I did until they released IE7.  You see IE6 lacks the inherit ability to cope with the transparency layer in PNG files.  There are of course a lot of hacks to get around this which I will not go [...]]]></description>
			<content:encoded><![CDATA[<p>It's true I love transparencies, unfortunately the great minds at Microsoft did not feel the way I did until they released IE7.  You see IE6 lacks the inherit ability to cope with the transparency layer in PNG files.  There are of course a lot of hacks to get around this which I will not go in depth into today.</p>
<p>If you want to read more about PNG's and IE6 <a href="http://blogs.pathf.com/agileajax/2008/04/hacking-transpa.html">read this post</a>.</p>
<p>Instead I would like to show a technique that I have used recently to create dynamic interfaces using a minimal set of graphic files.</p>
<p>Here is the problem I'm trying to solve.  I have a site that has a wonderful gradient Menu bar/ Nav Panel/ Box/ whatever that needs to change color or have multiple colors.  Now what you could do is make a bunch of different back grounds for each color you want or (my technique) have a transparent PNG cover the solid CSS based background color and simply change the color in CSS to match.</p>
<p>Here is an example of what a typical transparent nav bar will look like...<br />
<span id="more-3"></span><br />
In black..</p>
<div id="baseLayer" style="background-color:#000000;">
<div id="transparentLayer"><a href="#">Menu 1</a> <a href="#">Menu 2</a> <a href="#">Menu 3</a></div>
</div>
<p>In Blue...</p>
<div id="baseLayer" style="background-color:#001678;">
<div id="transparentLayer"><a href="#">Menu 1</a> <a href="#">Menu 2</a> <a href="#">Menu 3</a></div>
</div>
<p>In Yellow...</p>
<div id="baseLayer" style="background-color:#F5E822;">
<div id="transparentLayer"><a href="#">Menu 1</a> <a href="#">Menu 2</a> <a href="#">Menu 3</a></div>
</div>
<p>In Purple...</p>
<div id="baseLayer" style="background-color:#4A107C;">
<div id="transparentLayer"><a href="#">Menu 1</a> <a href="#">Menu 2</a> <a href="#">Menu 3</a></div>
</div>
<p>The only thing different in these examples is the Color code in the CSS</p>
<p>The first step in this process is to create the PNG file.  This is actually harder than you may think.  I use fireworks for my graphic design needs so I wont give you specifics but the technique should be similar in all graphics programs.</p>
<p>What you need to do is create a background image that is the same height as the nav bar you want to make. In this case the file I created is 1024 x 30 pixels.  The important part is not the size make sure you set your background to be transparent, not a solid color.</p>
<p>Next I make a layered background box so I can see what the gradient will look like. Then create a white box and apply a gradient to it.  You will want to adjust the opacity of the gradient at different sections to change the look, do not simply choose the color you want it to fade to.  So at every point in your gradient you should have the SAME color only different opacities. In my example the top of the transparency layer is 70% and by the middle of the graphic the opacity is 0%.</p>
<p>Next we have to code it in HTML and CSS.  Of course this would be a decidedly simpler process if you didn't have to account for IE6, but we still do so here it is.</p>
<p><strong>HTML</strong></p>
<pre class="html4strict">&nbsp;
<span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;baseLayer&quot;</span> <span style="color: #000066;">style</span>=<span style="color: #ff0000;">&quot;background-color:#000000;&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/div.html"><span style="color: #000000; font-weight: bold;">&lt;div</span></a> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">&quot;transparentLayer&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;#&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Menu 1<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;#&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Menu 2<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span>
<span style="color: #009900;"><a href="http://december.com/html/4/element/a.html"><span style="color: #000000; font-weight: bold;">&lt;a</span></a> <span style="color: #000066;">href</span>=<span style="color: #ff0000;">&quot;#&quot;</span><span style="color: #000000; font-weight: bold;">&gt;</span></span>Menu 3<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/a&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span>
<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/div&gt;</span></span>
&nbsp;</pre>
<p><strong>CSS</strong></p>
<pre class="css">&nbsp;
<span style="color: #cc00cc;">#baseLayer</span><span style="color: #66cc66;">&#123;</span>
position<span style="color: #3333ff;">:relative</span>;
width<span style="color: #3333ff;">:<span style="color: #933;">800px</span></span>;
height<span style="color: #3333ff;">:<span style="color: #933;">30px</span></span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#transparentLayer</span><span style="color: #66cc66;">&#123;</span>
position<span style="color: #3333ff;">:absolute</span>;
top<span style="color: #3333ff;">:<span style="color: #933;">0px</span></span>;
<span style="color: #000000; font-weight: bold;">left</span>: <span style="color: #933;">0px</span>;
width<span style="color: #3333ff;">:<span style="color: #933;">800px</span></span>;
height<span style="color: #3333ff;">:<span style="color: #933;">30px</span></span>;
background-image<span style="color: #3333ff;">:url</span><span style="color: #66cc66;">&#40;</span><span style="color: #ff0000;">'/images/transparentPNG.png'</span><span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<p><strong>Now the hack for IE6</strong></p>
<pre class="css">&nbsp;
* html <span style="color: #cc00cc;">#transparentLayer</span><span style="color: #66cc66;">&#123;</span>
background-image<span style="color: #3333ff;">:none</span>;
filter<span style="color: #3333ff;">:progid</span><span style="color: #3333ff;">:DXImageTransform</span><span style="color: #6666ff;">.Microsoft</span><span style="color: #6666ff;">.AlphaImageLoader</span>
<span style="color: #66cc66;">&#40;</span>src=<span style="color: #ff0000;">'/images/transparentPNG.png'</span>, sizingMethod=<span style="color: #ff0000;">'scale'</span><span style="color: #66cc66;">&#41;</span>;
&nbsp;
<span style="color: #66cc66;">&#125;</span>
&nbsp;</pre>
<p>Now I only showed you examples of the code that outlines the technique.  More css was required to make this example play nice.  Please feel free to examine the <a href='/customcss/transmenu.css'>full CSS</a> for my examples above, also go ahead and download the <a href='/images/transparentPNG.png'>transparent PNG</a>.  Looking at it is probably much simpler than trying to explain what I did in words.</p>
<p>I hope you enjoyed my first post.  Although I wont be posting often, when I do my intentions are for it to be significant ones.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.gavey.ca/index.php/2008/06/05/i-love-transparencies/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
