<?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>Full On Design &#187; JavaScript</title>
	<atom:link href="http://www.fullondesign.co.uk/coding/javascript-coding/feed" rel="self" type="application/rss+xml" />
	<link>http://www.fullondesign.co.uk</link>
	<description>Design &#38; Web Technologies</description>
	<lastBuildDate>Sun, 30 Oct 2011 21:37:16 +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>JavaScripts Selector Methods</title>
		<link>http://www.fullondesign.co.uk/coding/javascript-coding/1986-javascripts-selector-methods.htm</link>
		<comments>http://www.fullondesign.co.uk/coding/javascript-coding/1986-javascripts-selector-methods.htm#comments</comments>
		<pubDate>Fri, 18 Mar 2011 21:57:19 +0000</pubDate>
		<dc:creator>Rogem</dc:creator>
				<category><![CDATA[JavaScript]]></category>

		<guid isPermaLink="false">http://www.fullondesign.co.uk/?p=1986</guid>
		<description><![CDATA[I was recently introduced a group of really funky new HTML5 JavaScript methods, which make me seriously think we can avoid having to include the jQuery library in lots of small websites. These methods are querySelectorAll() and querySelector(). In a nutshell, these methods behave exactly the same as the jQuery selector but comes integrated into the browser, [...]]]></description>
			<content:encoded><![CDATA[<p>I was recently introduced a group of really funky new HTML5 JavaScript methods, which make me seriously think we can avoid having to include the jQuery library in lots of small websites. These methods are querySelectorAll() and querySelector().</p>
<p>In a nutshell, these methods behave exactly the same as the <a href="http://api.jquery.com/category/selectors/">jQuery selector</a> but comes integrated into the browser, meaning you input the CSS selector (e.g. &#8220;#myDiv&#8221; or &#8220;.MyClass&#8221;) and out pops the first element in the tree, or a StaticNodeList of the elements (depending on whether you use the All part) .</p>
<p><span id="more-1986"></span></p>
<h3>querySelector() Example</h3>
<p>The querySelector() method takes the CSS selector input, then returns a single element.</p>
<pre class="brush: plain; title: ; notranslate">
&lt;p id=&quot;myElem1&quot; class=&quot;classExample&quot;&gt;My First paragraph&lt;/p&gt;
&lt;p id=&quot;myElem2&quot; class=&quot;classExample&quot;&gt;My Second paragraph&lt;/p&gt;
&lt;form&gt;
	&lt;fieldset&gt;
		&lt;legend&gt;Input Field&lt;/legend&gt;
		&lt;label&gt;Check Me : &lt;input type=&quot;checkbox&quot; name=&quot;TickMe&quot; value=&quot;ticked&quot; /&gt;&lt;/label&gt;
		&lt;label&gt;Check Me : &lt;input type=&quot;checkbox&quot; name=&quot;TickMe&quot; value=&quot;ticked&quot; /&gt;&lt;/label&gt;
	&lt;/fieldset&gt;
&lt;/form&gt;
&lt;script&gt;
	document.querySelector('#myElem1').style.fontSize = &quot;1.2em&quot;; // Make the first paragraph 1.2em
	document.querySelector('p').style.color = &quot;#0D0&quot;; // This will only affect the first paragraph

	// You can also add event listeners...Again this will only affect the first checkbox.
	document.querySelector('input[type=checkbox]').addEventListener('click', function(e){alert(&quot;You Checked Me&quot;);});
&lt;/script&gt;
</pre>
<p><a href="http://fullondesign.co.uk/examples/JavaScripts_Selector_Methods/querySelector.html">View querySelector() Demo</a></p>
<h3>querySelectorAll() Example</h3>
<p>The querySelectorAll() method will return a StaticNodeList (Like an array) of elements in which you can cycle through.</p>
<pre class="brush: plain; title: ; notranslate">
&lt;p id=&quot;myElem1&quot; class=&quot;classExample&quot;&gt;My First paragraph&lt;/p&gt;
&lt;p id=&quot;myElem2&quot; class=&quot;classExample&quot;&gt;My Second paragraph&lt;/p&gt;
&lt;form&gt;
	&lt;fieldset&gt;
		&lt;legend&gt;Input Field&lt;/legend&gt;
		&lt;label&gt;Check Me : &lt;input type=&quot;checkbox&quot; name=&quot;TickMe&quot; value=&quot;ticked&quot; /&gt;&lt;/label&gt;
		&lt;label&gt;Check Me : &lt;input type=&quot;checkbox&quot; name=&quot;TickMe&quot; value=&quot;ticked&quot; /&gt;&lt;/label&gt;
	&lt;/fieldset&gt;
&lt;/form&gt;
&lt;script&gt;
	var classExample = document.querySelectorAll('.classExample'); // Get all the elements with class &quot;classExample&quot;
	for(i=0; i&lt;classExample.length; i++) {// Cycle through them
		classExample[i].style.fontSize = &quot;1.2em&quot;; // Change the fontSize.
	}

	// Add an click listner to the element #myElem1 and #myElem2
	var idExample = document.querySelectorAll('input[type=checkbox]');
	for(i=0; i&lt;idExample.length; i++) {// Cycle through them
		idExample[i].addEventListener('click', function(e){alert(&quot;You Clicked me!&quot;);}); // Add the alert.
	}
&lt;/script&gt;
</pre>
<p><a href="http://fullondesign.co.uk/examples/JavaScripts_Selector_Methods/querySelectorAll.html">View querySelectorAll() Demo</a></p>
<h3>Current browser support level</h3>
<p>Selectors are currently a W3C Candidate Recommendation, so they work in most browsers updated after January 2010. Thus for the most part you can use the above code examples in your current website and only IE6 level users will have an issue (Though, they are probably use to that). </p>
<p>However, if you have to support older browsers you can make use of the getElementsByClassName() method. For example:</p>
<pre class="brush: plain; title: ; notranslate">
&lt;p id=&quot;myElem1&quot; class=&quot;classExample&quot;&gt;My First paragraph&lt;/p&gt;
&lt;p id=&quot;myElem2&quot; class=&quot;classExample&quot;&gt;My Second paragraph&lt;/p&gt;
&lt;script&gt;
	if(!document.querySelectorAll){ // If the user does not have querySelectorAll()
		var classExample = document.getElementsByClassName('classExample'); // Get all the elements with class &quot;classExample&quot;
	}else{ // Otherwise do it the HTML5 way
		var classExample = document.querySelectorAll('.classExample');
	}

	for(i=0; i&lt;classExample.length; i++) {// Cycle through them
		classExample[i].style.fontSize = &quot;1.2em&quot;; // Change the fontSize.
	}
&lt;/script&gt;
</pre>
<p><a href="http://fullondesign.co.uk/examples/JavaScripts_Selector_Methods/getElementsByClassName.html">View Demo</a></p>
<h3>Further Reading</h3>
<p>I&#8217;ve only lightly covered this topic; here are a few pages which will give you much more information on the new HTML5 method.</p>
<ul>
<li><a href="http://ejohn.org/blog/thoughts-on-queryselectorall/">John Resig: Thoughts on querySelectorAll</a></li>
<li><a href="http://jclaes.blogspot.com/2010/11/html5-new-in-javascript-selector-api.html">Jef Claes: HTML5: New in the javascript Selector API</a></li>
<li><a href="http://www.w3.org/TR/selectors-api/">W3C: Selectors API Level 1</a></li>
<li><a href="http://www.amazon.co.uk/gp/product/0596805527/ref=as_li_ss_tl?ie=UTF8&#038;tag=fulondes-21&#038;linkCode=as2&#038;camp=1634&#038;creative=19450&#038;creativeASIN=0596805527">JavaScript: The Definitive Guide (Definitive Guides)</a><img src="http://www.assoc-amazon.co.uk/e/ir?t=&#038;l=as2&#038;o=2&#038;a=0596805527" width="1" height="1" border="0" alt="" style="border:none !important; margin:0px !important;" /></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.fullondesign.co.uk/coding/javascript-coding/1986-javascripts-selector-methods.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Google Chrome Frame &#8211; Good or Bad?</title>
		<link>http://www.fullondesign.co.uk/coding/javascript-coding/1218-google-chrome-frame-good-or-bad.htm</link>
		<comments>http://www.fullondesign.co.uk/coding/javascript-coding/1218-google-chrome-frame-good-or-bad.htm#comments</comments>
		<pubDate>Wed, 23 Sep 2009 00:52:43 +0000</pubDate>
		<dc:creator>Rogem</dc:creator>
				<category><![CDATA[Browsers]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Google Chrome Frame]]></category>
		<category><![CDATA[Internet Explorer]]></category>

		<guid isPermaLink="false">http://www.fullondesign.co.uk/?p=1218</guid>
		<description><![CDATA[Recently Google Announced a new exciting product called Google Chrome Frame. Which is an add-on for Internet Explorer which offers Internet Explorer users all the features of other browsers without having to install a different browser (When a certain Meta tag is used on a web page)? The video Google released explains the product in [...]]]></description>
			<content:encoded><![CDATA[<p>Recently Google Announced a new exciting product called <a href="http://code.google.com/chrome/chromeframe/">Google Chrome Frame</a>. Which is an add-on for Internet Explorer which offers Internet Explorer users all the features of other browsers without having to install a different browser (When a certain Meta tag is used on a web page)? The <a href="http://www.youtube.com/watch?v=sjW0Bchdj-w">video Google released</a> explains the product in a little more detail.</p>
<p align="center">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="560" height="340" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="allowFullScreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="src" value="http://www.youtube.com/v/sjW0Bchdj-w&amp;hl=en&amp;fs=1&amp;" /><param name="allowfullscreen" value="true" /><embed type="application/x-shockwave-flash" width="560" height="340" src="http://www.youtube.com/v/sjW0Bchdj-w&amp;hl=en&amp;fs=1&amp;" allowscriptaccess="always" allowfullscreen="true"></embed></object>
</p>
<p><span id="more-1218"></span></p>
<h3>How it works</h3>
<p>Google Chrome Frame seems quite easy to support, all the web developer needs to do is add the following code into the head of the web page they want to run like Google Chrome Frame:</p>
<p>
<pre class="brush: plain; title: ; notranslate">&lt;meta http-equiv=&quot;X-UA-Compatible&quot; content=&quot;chrome=1&quot;&gt;</pre>
</p>
<p>If the user has Google Chrome Frame installed the page will render like Chrome, if not the page will load as normal.</p>
<h3>First Impressions</h3>
<p>When I first saw this product I had two concerns:</p>
<ul>
<li>If a user knows they need a      better browsing experience, they should upgrade to a better browser.      Wouldn’t this just delay the uptake of better browsers?</li>
<li>If a user can&#8217;t upgrade to a      better browser (Due to corporate restrictions, low bandwidth or lack of      information) the odds they will be not be allowed to install Google Chrome      Frame. Which makes me wonder how many people will actually benefit from      it?</li>
</ul>
<p>Having said that the product also has its positive points, for example if a company has a network based on IE6 they may find that upgrading to another browser could cause their system to fail. Google Chrome Frame allows them to keep the old software while still work on more advanced browser bases developments, without breaking their network.</p>
<p>I can&#8217;t decide whether this product is beneficial for the development of the web, or if it&#8217;s just giving users another reason not to upgrade from Internet Explorer 6.</p>
<p>What do you think? Does Google Chrome Frame encourage users to not upgrade, or does it make web developers lives easier? Leave your views in the comment section below.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fullondesign.co.uk/coding/javascript-coding/1218-google-chrome-frame-good-or-bad.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Creating More User Friendly Forms with jQuery</title>
		<link>http://www.fullondesign.co.uk/coding/javascript-coding/1202-creating-more-user-friendly-forms-with-jquery.htm</link>
		<comments>http://www.fullondesign.co.uk/coding/javascript-coding/1202-creating-more-user-friendly-forms-with-jquery.htm#comments</comments>
		<pubDate>Fri, 11 Sep 2009 22:34:43 +0000</pubDate>
		<dc:creator>Rogem</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Usability]]></category>
		<category><![CDATA[user friendly]]></category>

		<guid isPermaLink="false">http://www.fullondesign.co.uk/?p=1202</guid>
		<description><![CDATA[Create forms on a web page is relatively simple, however what most developers forget is the golden rule of usability, &#8220;Users are Idiots&#8221;.  In a large number of websites they fail to provide a clear indication of how a form field needs to be formatted. Some even seem to even forget to clear the field [...]]]></description>
			<content:encoded><![CDATA[<p>Create forms on a web page is relatively simple, however what most developers forget is the golden rule of usability, &#8220;Users are Idiots&#8221;.  In a large number of websites they fail to provide a clear indication of how a form field needs to be formatted. Some even seem to even forget to clear the field when the user clicks into, which is really useful if your website has users with motor skills.</p>
<p>Here is a really neat piece of jQuery I use to make forms a little easier for users which takes little work to integrate (Just copy and paste before the </body> tag).</p>
<p><span id="more-1202"></span></p>
<pre class="brush: xml; title: ; notranslate">&lt;script type=&quot;text/javascript&quot; src=&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js&quot;&gt;&lt;/script&gt; &lt;!-- Pull the jQuery base from Google, it has CDN so it should be a little faster. --&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
  $(document).ready(function() {
    $(&quot;form input, form input, form textarea&quot;).css('color', '#484848');
	$(&quot;form .submit&quot;).css('color', '#000');
	$(&quot;form label&quot;).hover(function () {
		$(&quot;#infobox&quot;).html($(this).attr('title'));
	});
	$(&quot;form input, form input, form textarea&quot;).focus(function () {
		if($(this).val() == $(this).attr('title')){
			$(this).val('');
		}
		$(this).css('color', '#000');
	});
	$(&quot;form input, form input, form textarea&quot;).blur(function () {
		if($(this).val() == ''){
			$(this).val($(this).attr('title'));
			$(this).css('color', '#484848');
		}
	});
  });
&lt;/script&gt;</pre>
<p>It takes the title of the field and places it into the value, then clears the value when the user clicks into it. It also takes the value of the label and places it into an information box, which can help explain what a user needs to do.</p>
<p><a href="http://www.fullondesign.co.uk/examples/Creating_More_User_Friendly_Forms_with_jQuery/Creating_More_User_Friendly_Forms_with_jQuery.html">Here is an example</a> of the script in action. Feel free to copy, change and share it.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fullondesign.co.uk/coding/javascript-coding/1202-creating-more-user-friendly-forms-with-jquery.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>An introduction to jQuery</title>
		<link>http://www.fullondesign.co.uk/coding/javascript-coding/1167-an-introduction-to-jquery.htm</link>
		<comments>http://www.fullondesign.co.uk/coding/javascript-coding/1167-an-introduction-to-jquery.htm#comments</comments>
		<pubDate>Tue, 18 Aug 2009 21:57:15 +0000</pubDate>
		<dc:creator>Rogem</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jQuery]]></category>

		<guid isPermaLink="false">http://www.fullondesign.co.uk/?p=1167</guid>
		<description><![CDATA[JQuery is a JavaScript Framework intends to decrease the time it takes to code the user enhancements; a website should always be able to work without JavaScript. JavaScript is just to improve the user experience. Key Advantages of jQuery Very easy to learn and code. If you are familiar with basic JavaScript and CSS you [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://jquery.com/">JQuery</a> is a JavaScript Framework intends to decrease the time it takes to code the user enhancements; a website should always be able to work without JavaScript. JavaScript is just to improve the user experience.</p>
<h3>Key Advantages of jQuery</h3>
<ul>
<li>Very easy to learn and code.      If you are familiar with basic JavaScript and CSS you should be able to      pick it up quickly.</li>
<li>A wide range of plugins      available thanks to its large development community.</li>
<li>Its cross browser      compatibility is great. The same code will be able to work in Firefox, Chrome,      Opera, Safari or even IE6.</li>
<li>JQuery has fantastic      documentation, which has a Firefox search engine plugin.</li>
</ul>
<p>Unfortunately there is one disadvantage with jQuery. If a developer incorrectly utilizes it, the page loading times will drastically increase. This is mostly down to a developer adding lots of plugins without considering the total bandwidth required to send the data.</p>
<p><span id="more-1167"></span></p>
<p>Below are some simple examples of jQuery in action.</p>
<h3>JQuery &#8220;Shell&#8221; HTML</h3>
<p>This code sample shows how to include jQuery into a page. In some cases it&#8217;s better to place JavaScript at the bottom of the page as it decreases rendering time, as the JavaScript will be pulled once the page is already rendered instead of waiting for the file to load then continuing to render.</p>
<pre class="brush: xml; title: ; notranslate">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;
&lt;meta http-equiv=&quot;Content-Type&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;
&lt;title&gt;jQuery Shell&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;!-- Put your content here --&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://js.fullondesign.co.uk/jquery-1.3.2.min.js&quot;&gt;&lt;/script&gt;
&lt;!-- Include the jQuery Engine/Libary --&gt;
&lt;!-- Add any jQuery plugins here --&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
//&lt;![CDATA[
// Put your jQuery Here
//]]&gt;
&lt;/script&gt;
&lt;/body&gt;
&lt;/html&gt;</pre>
<h3>Changing the Class on an Object</h3>
<p>In this example, you will see how jQuery changes a class on an Object with the ID object. To select the object we (like in CSS) use the variable &#8220;#object&#8221;. Likewise if you wanted to select something by class, you would just use &#8220;.class_name_here&#8221;. In this example, we will use the <a href="http://docs.jquery.com/Attributes/addClass#class">addClass</a> &amp; <a href="http://docs.jquery.com/Attributes/removeClass#class">removeClass</a> attributes.</p>
<pre class="brush: xml; title: ; notranslate">&lt;div id=&quot;object&quot; class=&quot;empty&quot;&gt;&lt;/div&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://js.fullondesign.co.uk/jquery-1.3.2.min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
//&lt;![CDATA[
	$(&quot;#object&quot;).removeClass('empty');
	$(&quot;#object&quot;).addClass('full');
//]]&gt;
&lt;/script&gt;</pre>
<h3>Changing the InnerHTML of an object</h3>
<p>The code in this example is similar code to the last example. But this time using the <a href="http://docs.jquery.com/Attributes/html">html</a> attribute.</p>
<pre class="brush: xml; title: ; notranslate">&lt;div id=&quot;object&quot; class=&quot;empty&quot;&gt;&lt;/div&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://js.fullondesign.co.uk/jquery-1.3.2.min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
//&lt;![CDATA[
	$(&quot;#object&quot;).html('This is the jQuery InnerHTML in action');
//]]&gt;
&lt;/script&gt;</pre>
<p>This is quite a simplified introduction to jQuery, if you want to learn a little more about jQuery take a look at <a href="http://docs.jquery.com/How_jQuery_Works">how jQuery Works</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.fullondesign.co.uk/coding/javascript-coding/1167-an-introduction-to-jquery.htm/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Page Caching using disk: basic
Database Caching 4/21 queries in 0.012 seconds using disk: basic
Object Caching 339/378 objects using disk: basic

Served from: www.fullondesign.co.uk @ 2012-02-04 09:26:01 -->
