<?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>ajgraham.com &#187; Checkbox</title>
	<atom:link href="http://www.ajgraham.com/tag/checkbox/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ajgraham.com</link>
	<description>web design, development and consultation in Prague</description>
	<lastBuildDate>Fri, 02 Jul 2010 21:55:51 +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>XHTML and JavaScript checkbox colour change</title>
		<link>http://www.ajgraham.com/2009/10/xhtml-and-javascript-checkbox-colour-change/</link>
		<comments>http://www.ajgraham.com/2009/10/xhtml-and-javascript-checkbox-colour-change/#comments</comments>
		<pubDate>Sun, 18 Oct 2009 22:48:09 +0000</pubDate>
		<dc:creator>alex</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[Checkbox]]></category>
		<category><![CDATA[Colour Change Switch]]></category>
		<category><![CDATA[Colour Hover]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[MouseOver]]></category>
		<category><![CDATA[Style]]></category>

		<guid isPermaLink="false">http://www.ajgraham.com/?p=109</guid>
		<description><![CDATA[I wrote a very simple little piece of JavaScript that changes the colour, background colour and font colour of a checkbox depending on the Mouse Event (onclick, onmouseover and onmouseout) and whether the checkbox is ticked or not. It can also reset it back to its previous settings too.
XHTML:

&#60;label for="cb1" [...]]]></description>
			<content:encoded><![CDATA[<p>I wrote a very simple little piece of JavaScript that changes the colour, background colour and font colour of a checkbox depending on the Mouse Event (onclick, onmouseover and onmouseout) and whether the checkbox is ticked or not. It can also reset it back to its previous settings too.</p>
<h4>XHTML:</h4>
<pre>
<code>&lt;label for="cb1" id="lb1" onclick="mouseToggle('cb1', 'lb1', '#000', '#fff', '#cccccc', '#000000', true)" onmouseover="mouseToggle('cb1', 'lb1', '#000', '#fff', '#cccccc', '#000000', true)" onmouseout="mouseToggle('cb1','lb1','#000','#fff','#cccccc','#000000', false)"&gt;
&lt;input type="checkbox" name="test" value="Test Checkbox1" id="cb1"/&gt;Test Checkbox1&lt;/label&gt;</code>
</pre>
<h4>JavaScript:</h4>
<pre><code>function mouseToggle(checkbox,label,bgcolour,fontcolour,bgreset,fontreset,mouseIn){
	if(document.getElementById)
	{
		var cb = document.getElementById(checkbox);
		var label = document.getElementById(label);
		if(cb.checked == false)
		{
			if( mouseIn == true )
			{
				label.style.backgroundColor = bgcolour;
				label.style.color = fontcolour;
			}
			else
			{
				label.style.backgroundColor = bgreset;
				label.style.color = fontreset;
			}
		}
	}
}
</code></pre>
<h4>Example:</h4>
<p><a href="http://www.ajgraham.com/codestore/togglecheckbox/checkbox.html" target="_blank">Demo of functionality</a></p>
<p>Something similar was used for <a href="http://www.howdenparkcentre.co.uk" target="_blank">http://www.howdenparkcentre.co.uk</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ajgraham.com/2009/10/xhtml-and-javascript-checkbox-colour-change/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
