<?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>Carbonized Blog &#187; Javascript</title>
	<atom:link href="http://carbonize.co.uk/wp/tag/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://carbonize.co.uk/wp</link>
	<description>Just a bunch of stuff</description>
	<lastBuildDate>Fri, 25 Nov 2011 19:24:30 +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>IE9 Preview</title>
		<link>http://carbonize.co.uk/wp/2010/03/17/ie9-preview/</link>
		<comments>http://carbonize.co.uk/wp/2010/03/17/ie9-preview/#comments</comments>
		<pubDate>Wed, 17 Mar 2010 16:11:47 +0000</pubDate>
		<dc:creator>Carbonize</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[IE]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[web browsers]]></category>

		<guid isPermaLink="false">http://carbonize.co.uk/wp/?p=387</guid>
		<description><![CDATA[<a href="http://carbonize.co.uk/wp/2010/03/17/ie9-preview/" title="IE9 Preview"></a>Microsoft has released a preview version of Internet Explorer 9. It shows it&#8217;s CSS 3 support as well as it&#8217;s much improved JavaScript engine called Chakra. It also has support for some HTML 5. Certainly a big change from IE8. &#8230;<p class="read-more"><a href="http://carbonize.co.uk/wp/2010/03/17/ie9-preview/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://carbonize.co.uk/wp/2010/03/17/ie9-preview/" title="IE9 Preview"></a><p><div id="attachment_388" class="wp-caption alignleft" style="width: 160px"><a  href="http://carbonize.co.uk/wp/wp-content/uploads/2010/03/Dean_MIX10_1.png" class="thickbox no_icon" rel="gallery-387" title="IE9 Preview"><img src="http://carbonize.co.uk/wp/wp-content/uploads/2010/03/Dean_MIX10_1-150x150.png" alt="IE9 Preview" title="IE9 Preview" width="150" height="150" class="size-thumbnail wp-image-388" /></a><p class="wp-caption-text">IE9 Preview</p></div>Microsoft has released a preview version of Internet Explorer 9. It shows it&#8217;s CSS 3 support as well as it&#8217;s much improved JavaScript engine called <a  href="http://en.wikipedia.org/wiki/Chakra" target="_blank" title="Wikipedia entry for Chakra">Chakra</a>. It also has support for some HTML 5. Certainly a big change from IE8. It is only a basic browser with no navigation menu and you have to use Ctrl + O to open a URL or file. You can read more about it <a  href="http://blogs.msdn.com/ie/archive/2010/03/16/html5-hardware-accelerated-first-ie9-platform-preview-available-for-developers.aspx" target="_blank">on the MSDN IE blog</a> or download it from <a  href="http://ie.microsoft.com/testdrive/info/ThankYou/Default.html" target="_blank" title="Download IE9 preview">here</a>.</p>
<p>Microsoft has made it&#8217;s own range of tests that you can run and they can be found at <a  href="http://ie.microsoft.com/testdrive/" target="_blank">the IE9 test drive site</a>. It&#8217;s good to see how your current browser handles these tests as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://carbonize.co.uk/wp/2010/03/17/ie9-preview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Top Ten Javascript Functions</title>
		<link>http://carbonize.co.uk/wp/2009/04/28/top-ten-javascript-functions/</link>
		<comments>http://carbonize.co.uk/wp/2009/04/28/top-ten-javascript-functions/#comments</comments>
		<pubDate>Tue, 28 Apr 2009 04:13:07 +0000</pubDate>
		<dc:creator>Carbonize</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://carbonize.co.uk/wp/?p=260</guid>
		<description><![CDATA[<a href="http://carbonize.co.uk/wp/2009/04/28/top-ten-javascript-functions/" title="Top Ten Javascript Functions"></a>Whilst surfing the ether we call the internet I came across a list of top ten javascript functions by Dustin Diaz. As the saying goes it does exactly what it says on the tin. It is a collection of ten &#8230;<p class="read-more"><a href="http://carbonize.co.uk/wp/2009/04/28/top-ten-javascript-functions/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://carbonize.co.uk/wp/2009/04/28/top-ten-javascript-functions/" title="Top Ten Javascript Functions"></a><p>Whilst surfing the ether we call the internet I came across a list of <a  href="http://www.dustindiaz.com/top-ten-javascript/" target="_blank">top ten javascript functions</a> by Dustin Diaz. As the saying goes it does exactly what it says on the tin. It is a collection of ten (and a bonus one) basic javascript functions that most Javascript writers will need/use quite a lot. Such functions as adding onload events to the window even if you&#8217;re not sure that it&#8217;s already been set by another script. getElementByClass which to me is something that should of been in Javascript from the start <img src='http://carbonize.co.uk/wp/wp-includes/images/smilies/icon_mad.gif' alt=':mad:' class='wp-smiley' />  . If you write Javascript then you will find atleast one of the functions useful.</p>
<p>And I know it was written in 2005 but the functions are just as valid today.</p>
]]></content:encoded>
			<wfw:commentRss>http://carbonize.co.uk/wp/2009/04/28/top-ten-javascript-functions/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Browser Wars</title>
		<link>http://carbonize.co.uk/wp/2009/03/18/browser-wars/</link>
		<comments>http://carbonize.co.uk/wp/2009/03/18/browser-wars/#comments</comments>
		<pubDate>Wed, 18 Mar 2009 19:02:29 +0000</pubDate>
		<dc:creator>Carbonize</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Rants]]></category>
		<category><![CDATA[Firefox]]></category>
		<category><![CDATA[Google]]></category>
		<category><![CDATA[Opera]]></category>
		<category><![CDATA[Safari]]></category>

		<guid isPermaLink="false">http://carbonize.co.uk/wp/?p=186</guid>
		<description><![CDATA[<a href="http://carbonize.co.uk/wp/2009/03/18/browser-wars/" title="Browser Wars"></a>OK thanks to Google&#8217;s Chrome and Apple now making Safari a serious browser for Windows the browser war is getting ridiculous. They all seem obsessed with how fast their Javascript engines run with Google now saying the V8 engine in &#8230;<p class="read-more"><a href="http://carbonize.co.uk/wp/2009/03/18/browser-wars/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://carbonize.co.uk/wp/2009/03/18/browser-wars/" title="Browser Wars"></a><p>OK thanks to Google&#8217;s Chrome and Apple now making Safari a serious browser for Windows the browser war is getting ridiculous. They all seem obsessed with how fast their Javascript engines run with Google now saying the V8 engine in Chrome 2 is 25% faster than in Chrome 1. Who cares? The speed of the Javascript engines is now so fast few people if any would be able to notice a difference in everyday use. The only people who are are Geeks who think the extra milliseconds make all the difference.</p>
<p>I&#8217;m not interested in how fast their Javascript engines run I just want a browser that is configurable and doesn&#8217;t eat up resources. I&#8217;m sticking with Firefox at present as it lets me configure cookies exactly how I want and has some sweet extensions. I am impressed with the WebKit engine as used in Chrome and Safari. To me Opera fell to the wayside with version 7. So at some point I may switch from Firefox to Safari or Chrome but can&#8217;t see it anytime soon. Safari 4 beta looks good but is all eye candy and eats memory. Chrome is to basic with very limited options and no black/white list for cookies. Safari also has neither a whitelist nor blacklist.</p>
]]></content:encoded>
			<wfw:commentRss>http://carbonize.co.uk/wp/2009/03/18/browser-wars/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Javascript To Change Image On Link Click</title>
		<link>http://carbonize.co.uk/wp/2008/08/23/javascript-to-change-image-on-link-click/</link>
		<comments>http://carbonize.co.uk/wp/2008/08/23/javascript-to-change-image-on-link-click/#comments</comments>
		<pubDate>Sat, 23 Aug 2008 22:32:26 +0000</pubDate>
		<dc:creator>Carbonize</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Web Development]]></category>

		<guid isPermaLink="false">http://www.carbonize.co.uk/Blog/archives/49-guid.html</guid>
		<description><![CDATA[<a href="http://carbonize.co.uk/wp/2008/08/23/javascript-to-change-image-on-link-click/" title="Javascript To Change Image On Link Click"></a>I recently decided to add the ability for guests to request a new captcha image (or refresh the captcha image) in my guestbook script for when it was to hard for visitors to read. As usual trying to find some &#8230;<p class="read-more"><a href="http://carbonize.co.uk/wp/2008/08/23/javascript-to-change-image-on-link-click/">Read more &#187;</a></p>]]></description>
			<content:encoded><![CDATA[<a href="http://carbonize.co.uk/wp/2008/08/23/javascript-to-change-image-on-link-click/" title="Javascript To Change Image On Link Click"></a><p>I recently decided to add the ability for guests to request a new captcha image (or refresh the captcha image) in my guestbook script for when it was to hard for visitors to read. As usual trying to find some instructions to do this proved useless so I had to figure it out myself. I thought I would explain how it&#8217;s done here for anyone else wanting to do this and believe me it&#8217;s very very simple.</p>
<p>Ok first thing we need to do is give a name to the image we are going to by replacing/changing so we add a name. For the guestbook script I added added <em>name=&#8221;lazCaptcha&#8221;</em> to the image tag.</p>
<p>eg:</p>
<pre class="brush: javascript">&lt;img src=&quot;http://domain.com/path/image.jpg&quot; name=&quot;NAMEFORIMAGE&quot; alt=&quot;&quot; /&gt;</pre>
<p>Next we need to create the link that the viewer clicks on to replace/change the image and for that I used this bit of code:</p>
<pre class="brush: javascript">&lt;a href=&quot;#&quot; onclick=&quot;reloadImage(&#039;NAMEFORIMAGE&#039;); return false;&quot;&gt;request another image&lt;/a&gt;</pre>
<p>Notice how I put the name of the image into the Javascript? Thats so we can use this code multiple times on a single page.</p>
<p>Next we need the Javascript and it is very simple. We just create a random number to add to the image url to prevent it showing the cached image and then tell the browser to change the image. I&#8217;ll show two examples. The first is just when we want to display a random image and the second is how I display a new captcha image with the same code.</p>
<p><span id="more-10"></span>Random Image:</p>
<pre class="brush: javascript">
function reloadImage(imageName)
{
var myImages=new Array();
myImages[0]=&quot;sun.jpg&quot;;
myImages[1]=&quot;moon.jpg&quot;;
myImages[2]=&quot;stars.jpg&quot;;
// Create a random number between 1 and one greater than the number of items in the array
var randomImage = Math.floor(Math.random() * (myImages.length + 1));
randomImage--;
// Change the image
document.images[imageName].src = &#039;http://yoursite.com/path/to/&#039; + myImages[randomImage];
}</pre>
<p>Captcha Image:</p>
<pre class="brush: javascript">function reloadImage(imageName)
{
// Create a random number between 1 and 1000
var randomnumber=Math.floor(Math.random()*1001);
// Change the image
document.images[imageName].src = &#039;http://yoursite.com/path/image.php?hash=OURHASH&amp;rand=&#039; + randomnumber;
}</pre>
<p>OURHASH? What&#8217;s that?  <img src='http://carbonize.co.uk/wp/wp-includes/images/smilies/icon_confused.gif' alt=':-?' class='wp-smiley' />   Well if you are planning to refresh a captcha image then I&#8217;m guessing you have generated the form the image is displayed in and so you can just use the variable you used for the hash in the image tag to put the hash in the javascript image tag. Or you could just change that line to</p>
<pre class="brush: javascript">document.images[imageName].src = document.images[imageName].src + &#039;&amp;rand=&#039; + randomnumber; // Change the image</pre>
<p>And thats it. See how simple it is to do?  <img src='http://carbonize.co.uk/wp/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://carbonize.co.uk/wp/2008/08/23/javascript-to-change-image-on-link-click/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

