<?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>CouldBe Studios &#187; javascript</title>
	<atom:link href="http://www.couldbestudios.com/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.couldbestudios.com</link>
	<description>small business web design and development in Portland Oregon</description>
	<lastBuildDate>Thu, 19 Aug 2010 22:05:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Baktuli</title>
		<link>http://www.couldbestudios.com/clients/baktuli/</link>
		<comments>http://www.couldbestudios.com/clients/baktuli/#comments</comments>
		<pubDate>Sat, 20 Mar 2010 06:30:18 +0000</pubDate>
		<dc:creator>Jessica</dc:creator>
				<category><![CDATA[clients]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[shopify]]></category>
		<category><![CDATA[site launch]]></category>
		<category><![CDATA[typography]]></category>
		<category><![CDATA[web design]]></category>

		<guid isPermaLink="false">http://www.couldbestudios.com/?p=328</guid>
		<description><![CDATA[We love doing Shopify sites, and this one was a blast! Henry needed a site to showcase his fabulous new collection of luxury yoga towels. His design preference was upscale minimalism, and the site reflects that with a clean white background and dark gray typography. The only splash of color comes from the towels, which [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.couldbestudios.com/whatcouldbe/blog/wp-content/uploads/2010/03/baktuli.png"><img src="http://www.couldbestudios.com/whatcouldbe/blog/wp-content/uploads/2010/03/baktuli-294x300.png" alt="Baktuli" title="Baktuli web site screenshot" width="294" height="300" class="alignleft size-medium wp-image-329" /></a>We love doing Shopify sites, and this one was a blast! </p>
<p>Henry needed a site to showcase his fabulous new collection of luxury yoga towels. His design preference was upscale minimalism, and the site reflects that with a clean white background and dark gray typography. The only splash of color comes from the towels, which take center stage on the home page slideshow. </p>
<p>Henry&#8217;s fabulous photography definitely took this site to the next level. Visit <a href="http://www.baktuli.com">Baktuli.com</a> to check it out yourself!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.couldbestudios.com/clients/baktuli/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tutorial: How to Make a Size Selector Control (CSS &#8211; Javascript)</title>
		<link>http://www.couldbestudios.com/web-design/tutorial-how-to-make-a-size-selector-control-css-javascript/</link>
		<comments>http://www.couldbestudios.com/web-design/tutorial-how-to-make-a-size-selector-control-css-javascript/#comments</comments>
		<pubDate>Thu, 04 Oct 2007 00:29:48 +0000</pubDate>
		<dc:creator>Matt</dc:creator>
				<category><![CDATA[couldbe studios]]></category>
		<category><![CDATA[tutorials]]></category>
		<category><![CDATA[web design]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://whatcouldbe.com/blog/?p=68</guid>
		<description><![CDATA[Ever wonder how to make one of those little size selector things that t-shirt sites use in forms? This question came up recently, so here is a (fairly) simple solution for it that doesn&#8217;t rely on images. We&#8217;ll be using a simple text-replacement technique (css), with a little bit of straightforward javascript and a set [...]]]></description>
			<content:encoded><![CDATA[<p>Ever wonder how to make one of those little size selector things that t-shirt sites use in forms?</p>
<p>This question came up recently, so here is a (fairly) simple solution for it that doesn&#8217;t rely on images.</p>
<p>We&#8217;ll be using a simple text-replacement technique (css), with a little bit of straightforward javascript and a set of radio buttons to achieve the desired effect.</p>
<p>Here is the finished product.<br />
<iframe src="http://www.whatcouldbe.com/tutorials/sizeselector/example.htm" height="50" width="200" frameborder="0" framespacing="0"><a href="http://www.whatcouldbe.com/tutorials/sizeselector/example.htm">example</a></iframe></p>
<p><a href="http://www.whatcouldbe.com/tutorials/sizeselector/example.htm">&raquo;example source page</a></p>
<p>first lets take a look at the markup we&#8217;ll be using for this. Since the desired effect is that of a radio button set, we&#8217;ll start there.</p>
<pre style="font-size:1.2em;color:#69c;">
&lt;form name="myform">
   &lt;div class="radios" id="set1">
      &lt;input type="radio" class="hidden" name="test" id="test1" value="SM">
      &lt;label for="test1" onClick="setChecked(this, set1);">SM&lt;/label>

      &lt;input type="radio" class="hidden" name="test" id="test2" value="M">
      &lt;label for="test2" onClick="setChecked(this, set1);">M&lt;/label>

      &lt;input type="radio" class="hidden" name="test" id="test3" value="L" checked>
      &lt;label for="test3" onClick="setChecked(this, set1);" class="checked">L&lt;/label>

      &lt;input type="radio" class="hidden" name="test" id="test4" value="XL">
      &lt;label for="test4" onClick="setChecked(this, set1);">XL&lt;/label>

      &lt;input type="radio" class="hidden" name="test" id="test5" value="2X">
      &lt;label for="test5" onClick="setChecked(this, set1);">2X&lt;/label>
   &lt;/div>
&lt;/form>
</pre>
<p>Here is a fairly simple bit of our form. For this example, all you really need is a radio set with labels. We&#8217;re wrapping the radio set in a div with a class of &#8216;radios&#8217; just to make sure that we don&#8217;t trample over any other styles in our CSS later on. We&#8217;ll also give this an ID so that we can adjust the className of these elements without screwing up other labels you might have in your form</p>
<p>Note: It&#8217;s important that each button has an ID so that the label->for relationship will work correctly.</p>
<p>Most of the activity is going to take place on the labels, since we&#8217;re going to hide the actual radio controls. We&#8217;ll use the onClick event to trigger our little bit of javascript, which will allow us to change the style of the label to reflect that it has been clicked.</p>
<p>Let&#8217;s take a look at that:</p>
<pre style="font-size:1.2em;color:#69c;">
function setChecked(label, container)
	{
	/* clear previous checked status */
	var labels=container.getElementsByTagName('label');
	for(i=0; i&lt;labels.length; i++)
		{
		labels[i].className="unchecked";
		}

	/* set current label to checked */
	label.className="checked";
	}
</pre>
<p>Pretty simple, right? All we&#8217;re doing is looping over the labels in the container and resetting them all to a default class before we set the current label to &#8216;checked&#8217;.</p>
<p>Last, but not least there is some CSS that we&#8217;ll need to use to pull this all together.</p>
<pre style="font-size:1.2em;color:#69c;">
.radios .hidden{
	position:absolute;
	left:-9999px;
	}
</pre>
<p>This is important, we&#8217;re using a simple text-replacement to hide the radio buttons without rendering them inert, since we want to be able to capture the value we&#8217;ve chosen.</p>
<pre style="font-size:1.2em;color:#69c;">
.radios .checked{
	color:#fc0;
	background:#333;
	}
.radios .unchecked{
	color:#000;
	background:#fff;
	}
.radios label{
	border:1px solid #555;
	width:20px;
	height:20px;
	font-size:10px;
	line-height:20px;
	font-family:sans-serif;
	text-align:center;
	background:#fff;
	display:block;
	position:relative;
	float:left;
	margin-right:1px;
	}
</pre>
<p>The rest of that is just styling to make them nice looking little boxes.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.couldbestudios.com/web-design/tutorial-how-to-make-a-size-selector-control-css-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
