<?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>Chris Stead &#187; Javascript</title>
	<atom:link href="http://www.chrisstead.com/archives/category/coding/javascript/feed" rel="self" type="application/rss+xml" />
	<link>http://www.chrisstead.com</link>
	<description>Web, the Universe and everything</description>
	<lastBuildDate>Fri, 23 Mar 2012 18:56:43 +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>Javascript Debugging: The Slick Way</title>
		<link>http://www.chrisstead.com/archives/494</link>
		<comments>http://www.chrisstead.com/archives/494#comments</comments>
		<pubDate>Fri, 23 Mar 2012 18:56:43 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Internet Culture]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Site Architecture]]></category>
		<category><![CDATA[World Wide Weird]]></category>

		<guid isPermaLink="false">http://www.chrisstead.com/?p=494</guid>
		<description><![CDATA[So, we all know about FireBug, right? That handy dandy little debugging utility for Javascript. It&#8217;s great and all as long as you actually have a syntax error in your script. The console says a lot about the issues it found, unrecoverable errors and all that. What if your script doesn&#8217;t actually bomb, it just [...]]]></description>
			<content:encoded><![CDATA[<p>So, we all know about FireBug, right?  That handy dandy little debugging utility for Javascript.  It&#8217;s great and all as long as you actually have a syntax error in your script.  The console says a lot about the issues it found, unrecoverable errors and all that.  What if your script doesn&#8217;t actually bomb, it just doesn&#8217;t do what it&#8217;s supposed to?<span id="more-494"></span></p>
<p>If you&#8217;re anything like me, you&#8217;ve used the alert message function as a means to figure out where things were falling apart.  That&#8217;s great and all, except that it sucks.  I hate needing popup messages to debug things like mouseovers.  It&#8217;s no fun.  If you forget to pull one out of your code before it goes to production, it can be miserable trying to track it down later when users are getting alerts that say things like &#8220;Why doesn&#8217;t my function work??&#8221;</p>
<p>Whoops.</p>
<p>So, I started thinking about developing in pretty much any other language out there, but mainly Java since I have to touch that only slightly less than I touch PHP scripts.  Java is great because you can output directly to a console, so you can log stuff and watch as the mayhem unfolds while your program bombs.  It&#8217;s REALLY helpful.</p>
<p>SO&#8230;</p>
<p>I decided I wanted a console I could output to at any time.  Something I could review on the fly and see what is happening.  This would allow me to review any logged output I wanted in real time, and I could avoid the alert box altogether.  Hmm&#8230; what could I output to? The DOM!</p>
<p>Right??</p>
<p>I sat down and cranked out a handy dandy script that will write to whatever div you decide to use as a console.  If you are lazy, like me, then it will also do something really spiffy and just append a console to the end of your document.</p>
<p>The nice thing is you can just define a console div and write to it.  When you send your code to production, you can just style your console with display:none.  If you forgot to pull a write statement out of your code somewhere, the world won&#8217;t come to an end, and your users will be none the wiser. (For the record, I still strongly encourage you to NOT leave test code in your production code. This is just a CYA measure.)</p>
<p>So, where is this code and what do you do to make it go?</p>
<p>Let&#8217;s start with the &#8220;making it go&#8221; part first.  Include the script in your code, I&#8217;ll give you a link to the file in a moment. Then add this line of code to your document:</p>
<p>var ow = new OutputWriter();</p>
<p>Tadaaa!!</p>
<p>You now have a console on your page you can write to.  If you want to write to the console for whatever reason, it goes a little like this:</p>
<p>ow.writeln(&#8220;your message.&#8221;);</p>
<p>If you made your own console, and you want to write to it, then instantiate the writer thusly:</p>
<p>var ow = new OutputWriter({ consoleId: &#8220;your_console_id&#8221; });</p>
<p>There are other things it can do as well, like clear the console:</p>
<p>ow.clear();</p>
<p>Store and retrieve cleared history:</p>
<p>var ow = new OutputWriter({ consoleId: &#8220;your_console_id&#8221;, storeHistory: 1 });<br />
ow.clear();<br />
var history0 = ow.gethistory(0);</p>
<p>You get the idea.</p>
<p>There are more parameters you can set too.  I put them all in the comments at the top so you can decide what to use and what to skip.  They are all 100% optional, so don&#8217;t worry about it if you don&#8217;t want to set them.</p>
<p>So, on with the script, already!  Just download <a href="http://www.chrisstead.com/media/OutputWriter.js" target="_blank">this one little file</a> and you have everything you need to do all of the console-writing magic I described and, potentially, more.  Debug your code with grace and style and make the web a better place.</p>
<p>&copy;2012 <a href="http://www.chrisstead.com">Chris Stead</a>. All Rights Reserved.</p>.]]></content:encoded>
			<wfw:commentRss>http://www.chrisstead.com/archives/494/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Balance is Everything</title>
		<link>http://www.chrisstead.com/archives/321</link>
		<comments>http://www.chrisstead.com/archives/321#comments</comments>
		<pubDate>Tue, 01 Jun 2010 17:55:57 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[Site Architecture]]></category>
		<category><![CDATA[User Experience]]></category>

		<guid isPermaLink="false">http://www.chrisstead.com/?p=321</guid>
		<description><![CDATA[Earlier this year I discussed progressive enhancement, and proposed that a web site should perform the core functions without any frills. Last night I had a discussion with a friend, regarding this very same topic. It came to light that it wasn&#8217;t clear where the boundaries should be drawn. Interaction needs to be a blend [...]]]></description>
			<content:encoded><![CDATA[<p>Earlier this year I discussed <a href="http://www.chrisstead.com/archives/226" target="_blank">progressive enhancement</a>, and proposed that a web site should perform the core functions without any frills.  Last night I had a discussion with a friend, regarding this very same topic.  It came to light that it wasn&#8217;t clear where the boundaries should be drawn.  Interaction needs to be a blend of server- and client-side technologies.</p>
<p>Ultimately, it is rarely clear where boundaries are in a project.  What is too much, what is too little?  Somewhere between too much and too little is just right, much like what Goldilocks wanted in her porridge.  We know that even the most limited of users should be able to access our sites within certain considerations.  A photo gallery is, ultimately, little use to a blind person, but alt tags should still be in place.  Sound clips of the Boston Philharmonic Orchestra would be useless to a deaf person, though a caption or indication as to what each sound clip is would be quite handy.</p>
<p>Coming back to the point, finding a balance point is critical to providing rich, meaningful interaction between your user and your site.  Perhaps the first question which should be answered is &#8220;can this be done without Technology X?&#8221;<span id="more-321"></span></p>
<p>Technology X is always the hot technology everyone is dying to use.  Flash, AJAX, CSS3, these all have fallen under the Technology X heading at one point or another.  By using Technology X as your baseline interaction, you may be causing your users pain when you thought you were enhancing their experience.</p>
<p>A prime example of where Technology X is used when standard interaction would do is the Google login procedure.  Many, if not all, of Google&#8217;s login boxes use AJAX for verification of user creds.  It sounds cute and looks vaguely neat, but what happens when the browser barfs on their Javascript or you suddenly lose your internet connection?  You have no clue what happened.</p>
<p>Your experience just took a nose dive and left you in the dark.</p>
<p>This is especially bad news for something like a login.  Logging into a website should be a simple, straightforward, FAST experience.  I want to type my creds, log in and be on my way to my dashboard.  If something dies unexpectedly, I want a clean, clear indication as to what happened and why.  If someone cut my ethernet cable in the next room, I want to know my computer lost network connectivity and that&#8217;s why I&#8217;m not seeing my dashboard in all its glory.</p>
<p>CSS is another item which can choke on users, leaving them feeling lost and confused.  When things are hidden or altered with CSS in a way that makes them unreadable or unusable to the user, it can get ugly.  The user sees a damaged site and moves along.  Your rep falls to pieces and your user has moved on to greener pastures.  This is especially true for people using Javascript to reveal something hidden with CSS.</p>
<p>The phrase &#8220;if it is to be shown with Javascript, hide it with Javascript,&#8221; carries a lot of weight with me.  If your Javascript is going to die, it would be preferable that you err on the side of caution.  Show everything.  Make sure the page is as usable as possible.</p>
<p>So, the balancing act.  I&#8217;m not saying there is no room for Technology X.  The Technology X of today is the old standby of tomorrow.  People will become familiar with new technology and learn to expect it.  In the meanwhile it is important to consider what your user is aiming to do.</p>
<p>As a friend of mine likes to quote: Proper prior planning prevents piss poor performance.  Know what it is your user is trying to accomplish by using your site.  If they are there to purchase widgets, build a no-frills site which sells widgets.  Use styles only to make the page more readable.  Make sure everything makes sense without styles.  Don&#8217;t use Javascript to do anything.  Let the server do all the grunt work.</p>
<p>If you plan your site carefully and build something which is clear, usable and meaningful, adding Technology X will only make the site better.  If something fails, your user will still be able to interact with the site and get things done.  It may take them an extra click here or there, but it won&#8217;t be the show stopper it would have been if Technology X had been your only approach.</p>
<p>Balance is everything.  Balance your plain site with your desire to incorporate interesting new technology.  Just because it might be neat to see something done with AJAX doesn&#8217;t mean you should.  Flash doesn&#8217;t solve all world ills.  Sometimes a little bit of HTML a dash of simple CSS and some server-side elbow grease will do just fine.  Build your sites for real use.  Make your toys secondary.  Think about your users&#8217; goals and make the web a better place.</p>
<p>&copy;2012 <a href="http://www.chrisstead.com">Chris Stead</a>. All Rights Reserved.</p>.]]></content:encoded>
			<wfw:commentRss>http://www.chrisstead.com/archives/321/feed</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Degrading Behavior: Graceful Integration</title>
		<link>http://www.chrisstead.com/archives/226</link>
		<comments>http://www.chrisstead.com/archives/226#comments</comments>
		<pubDate>Fri, 26 Feb 2010 17:00:26 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[SEO]]></category>
		<category><![CDATA[Site Architecture]]></category>
		<category><![CDATA[User Experience]]></category>

		<guid isPermaLink="false">http://www.chrisstead.com/?p=226</guid>
		<description><![CDATA[There has been a lot of talk about graceful degradation. In the end it can become a lot of lip service. Often people talk a good talk, but when the site hits the web, let&#8217;s just say it isn&#8217;t too pretty. Engineers and designers work together, or divided as the case may be, to create [...]]]></description>
			<content:encoded><![CDATA[<p>There has been a lot of talk about graceful degradation.  In the end it can become a lot of lip service.  Often people talk a good talk, but when the site hits the web, let&#8217;s just say it isn&#8217;t too pretty.</p>
<p>Engineers and designers work together, or divided as the case may be, to create an experience that users with all of their faculties and a modern browser can enjoy.  While this goes down, the rest of the world is left feeling a bit chilly.</p>
<p>What happens is, the design starts with the best of intentions and, then, the interactivity bug takes hold.  What comes out is something that is almost usable when slightly degraded, but totally non-functional when degraded to the minimum.<span id="more-226"></span></p>
<p>In the end, of course, the user needs must be considered.  Having a graphically intensive site doesn&#8217;t hurt if you are a design firm, but might not be the best option for a company dealing with medical customers.</p>
<p>My suggestion, however, is simple.  Instead of degrading your site as the user needs become greater, start with a site that is usable at the lowest common denominator and work up.</p>
<p>Understand who your audience is and prepare to serve those of them who have the greatest needs.  Build a site that is attractive and works if the user can only view it through a program that reads for them.</p>
<p>Once your site has been built and is fully functional, build up.  Integrate functions to serve the users that have some needs, but aren&#8217;t in the highest-need area on the spectrum.</p>
<p>Continue on this path until you have integrated all of the latest and greatest, bleeding-edge functions that your highest-ability users can interact with.</p>
<p>As you build this way, be sure that you are simply enhancing the function that is already on the screen.  As you add enhancements, you should be able to remove them cleanly and still get the same experience you started with.</p>
<p>I call this approach graceful integration.  Each progressive step, you integrate more functionality and interaction, preserving the layer just below as a separate user interaction.</p>
<p>Each progressive enhancement should be separate and easily disabled.  The granularity of your enhancements can be as large as a two-step approach: all or nothing.  You may also enhance your site in a careful way that allows for several levels of degradation depending on the user and their distinct needs.</p>
<p>A natural separation of user interaction happens when HTML is written, CSS is added and Javascript acts upon the subsequent design.  This three-tier separation, you can use the work that will be done regardless to define your user interaction in a clean way.</p>
<p>One of the best quotes I&#8217;ve heard regarding graceful degradation, in paraphrase, is, &#8220;if you show it with Javascript, hide it with Javascript.&#8221;  I offer this with no source as I can&#8217;t recall where I heard it.  If you know/are the author of this, stand up and reap the rewards.</p>
<p>The attitude in this quote represents the core of graceful integration.  As you pile the Javascript on, be sure you manage its behavior with Javascript.  Don&#8217;t use CSS to manage something that is going to be handled with Javascript.  If you must, prepare a style sheet that defines scripted behavior, but set the object classes with Javascript.</p>
<p>There are other benefits you&#8217;ll gain from this approach.  Not only will your users appreciate the time and care you put into their experience, so will the search engines.</p>
<p>As search spiders crawl your site, they won&#8217;t see any CSS that looks to be doing something sneaky like hiding text from the viewer.  Spiders have gotten smarter and they recognize when something fishy is going on.  As you are already doing something good for your users, you get this bonus for free.</p>
<p>For those of you looking for snippets of code, the best thing you could know and rely on is the &#8220;noscript&#8221; tag.  This is a tag which defines the behavior of the page for users without Javascript.  I use this quote a bit to display extra form controls when Javascript has been disabled or is unavailable to the user.  You can use it like the following:</p>
<p>&lt;script type=&#8221;text/javascript&#8221;&gt;<br />
     //your script logic goes here<br />
&lt;/script&gt;<br />
&lt;noscript&gt;<br />
&lt;!&#8211; HTML elements go here like style definitions or form controls. &#8211;><br />
&lt;/noscript&gt;</p>
<p>You can also use noscript by itself scattered throughout the page to display page elements that might, otherwise, be missing for some of your users.</p>
<p>In the end, behavior on your site should be defined by the HTML first, the CSS second and the Javascript third.  Should you choose to go to a finer granularity, don&#8217;t forget to double check your users can still use all of the layers effectively.  Be mindful of your users, integrate function into your site in stages and make the web a better place.</p>
<p>&copy;2012 <a href="http://www.chrisstead.com">Chris Stead</a>. All Rights Reserved.</p>.]]></content:encoded>
			<wfw:commentRss>http://www.chrisstead.com/archives/226/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>User Experience Means Everyone</title>
		<link>http://www.chrisstead.com/archives/180</link>
		<comments>http://www.chrisstead.com/archives/180#comments</comments>
		<pubDate>Fri, 05 Feb 2010 17:00:12 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[ASP.Net]]></category>
		<category><![CDATA[Coding]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Site Architecture]]></category>
		<category><![CDATA[User Experience]]></category>

		<guid isPermaLink="false">http://www.chrisstead.com/?p=180</guid>
		<description><![CDATA[I&#8217;ve been working on a project for an internal client, which includes linking out to various medical search utilities. One of the sites we are using as a search provider offers pharmacy searches. The site was built on ASP.Net technology, or so I would assume as all the file extensions are &#8216;aspx.&#8217; I bring this [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on a project for an internal client, which includes linking out to various medical search utilities.  One of the sites we are using as a search provider offers pharmacy searches.  The site was built on ASP.Net technology, or so I would assume as all the file extensions are &#8216;aspx.&#8217;  I bring this provider up because I was shocked and appalled by their disregard for the users that would be searching.</p>
<p>This site, which shall remain unnamed, commits one of the greatest usability crimes I&#8217;ve seen: they rely only on Javascript to submit their search.  In order to give you, dear reader, the scope of the issue, I always test sites like these by disabling Javascript and testing the function again.</p>
<p>The search stopped working.<span id="more-180"></span></p>
<p>Mind you, if this was some sort of specialized search geared toward people that were working with Javascript technology, I might be able to see requiring Javascript in order to make the search work properly.  Even in circumstances like the aforementioned search, shutting down the search with Javascript disabled is still questionable.</p>
<p>This, however, is a search for local pharmacies.</p>
<p>Considering the users that might be searching for a pharmacy, we can compile a list.  This is not comprehensive: the young, the elderly, the rich, the poor, sick people, healthy people, disabled people and blind people.  I&#8217;ll stop there.</p>
<p>Let&#8217;s consider a couple of select groups in that list, i.e. the poor, the disabled and the blind.  The less money you have the less likely you are to buy a new computer if your old one still works.  I know this sounds funny, but I&#8217;ve seen people using Internet Explorer 5.5 to access sites in the insurance world.  Lord knows what other antiques they might use to access a site.  Suffice to say, people with old computers may not support the AJAX calls made by an AJAX only search.</p>
<p>Let&#8217;s, now, consider the two groups who are much larger than the  IE 5.5 crowd: the disabled and blind.  I separate these two so we can think about different situations for each.</p>
<p>First, the blind.  Blind people use screen readers to view web sites. Though I am unsure as to the latest capabilities of screen readers, but the last time I did reading about screen readers for the blind, I was brought to understand that their experience is a little like using Lynx.  See a screencap below to get an idea of what Lynx is like.</p>
<div id="attachment_182" class="wp-caption alignnone" style="width: 310px"><a href="http://www.chrisstead.com/wp-content/uploads/2010/02/lynx1.png"><img src="http://www.chrisstead.com/wp-content/uploads/2010/02/lynx1-300x210.png" alt="ChrisStead.com on Lynx" width="300" height="210" class="size-medium wp-image-182" /></a><p class="wp-caption-text">ChrisStead.com on Lynx</p></div>
<p>As you can see, browsing for the blind is kind a no-frills venture.  No CSS, no Javascript, no imagery.  Since many of them can&#8217;t see what you have made available, (yes, there are varying degrees of blindness) they have to rely on a program to read the screen for them.  This means, pages that rely on Javascript for core functionality are out of reach for these users.</p>
<p>In much the same way, disabled users may have a limited set of functions they can access within their browser.  This will depend on the degree of disability and the breadth of function on their browser.  I can&#8217;t and won&#8217;t say what a disabled browsing experience is like since I am not disabled and the experience varies so widely it&#8217;s not possible to pin down what the overall experience is like.  Suffice to say, it is limited.</p>
<p>Now, the reason I mentioned the site was built on ASP.Net:  For whatever reason, the sites I see with the worst usability almost always seem to be built on ASP.Net.  I have a hard time wrapping my head around this, as I&#8217;ve built ASP/C# apps and had no problem building the core functions to operate with or without Javascript enabled.  Everything you need is right at your fingertips.</p>
<p>From sites that require users to be on a windows machine using the newest version of Internet Explorer, to web apps that require users have Javascript and images enabled just to navigate the core functions, ASP sites often seem to be bottom of the barrel.</p>
<p>Perhaps it is a group of people that are used to developing for desktop apps and haven&#8217;t had to consider usability in the modern age of the web.  Perhaps it&#8217;s novice developers that don&#8217;t understand some of the core concepts that go into building successful web applications.  Either way, the current trend of ASP disabled-inaccessibility must come to an end.</p>
<p>To the ASP.Net developers of the world, I implore you to reconsider your development goals and meet the needs of your customers.  To the rest of you that may be committing the same sins in another language, I beg you to be considerate of all of your users, instead of a select group.  Think about usability for a degraded experience, build accordingly and make the web a better place.</p>
<p>&copy;2012 <a href="http://www.chrisstead.com">Chris Stead</a>. All Rights Reserved.</p>.]]></content:encoded>
			<wfw:commentRss>http://www.chrisstead.com/archives/180/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Accessibility and graceful degradation</title>
		<link>http://www.chrisstead.com/archives/12</link>
		<comments>http://www.chrisstead.com/archives/12#comments</comments>
		<pubDate>Tue, 11 Dec 2007 23:51:54 +0000</pubDate>
		<dc:creator>Chris</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Site Architecture]]></category>
		<category><![CDATA[User Experience]]></category>

		<guid isPermaLink="false">http://www.chrisstead.com/?p=12</guid>
		<description><![CDATA[Something that I have learnt over time is how to make your site accessible for people that don&#8217;t have your perfect 20/20 vision, are working from a limited environment or just generally have old browsing capabilities. Believe it or not, people that visit my web sites still use old computers with old copies of Windows. [...]]]></description>
			<content:encoded><![CDATA[<p>Something that I have learnt over time is how to make your site accessible for people that don&#8217;t have your perfect 20/20 vision, are working from a limited environment or just generally have old browsing capabilities. Believe it or not, people that visit my web sites still use old computers with old copies of Windows. Personally, I have made the Linux switch everywhere I can. That being said, I spend a certain amount of time surfing the web using Lynx. This is not due to the fact that I don&#8217;t have a GUI in Linux. I do. And I use firefox for my usual needs, but Lynx has a certain special place in my heart. It is in a class of browser that sees the web in much the same way that a screen reader does. For example, all of those really neat iframes that you use for dynamic content? Yeah, those come up as &#8220;iframe.&#8221; Totally unreadable. Totally unreachable. Iframe is an example of web technology that is web-inaccessible. Translate this as bad news.</p>
<p>Let&#8217;s talk about <acronym title="HyperText Markup Language">HTML</acronym> and <acronym title="Extensible HyperText Markup Language">XHTML</acronym>. These are both derivatives of <acronym title="Standard Generalized Markup Language">SGML</acronym> which is a generalized markup language that is used to describe data. That&#8217;s it. SGML doesn&#8217;t make things &#8220;look&#8221; a certain way. You won&#8217;t find it hanging around the local bar trying to pick up girls. It&#8217;s just data description. Kind of geeky, like that kid that sits in the back of class playing with his&#8230; calculator. So, then HTML was developed with it&#8217;s own <acronym title="Document Type Definition">DTD</acronym>so that people could describe the information contained in their HTML documents.  Early HTML was easy to interpret if it was coded well, however most people are sloppy with their code.  This led the W3C to create a code validator.  Now, based on the DTD that you use your document may be standards complient or it may not.  Personally I really like to stay within the bounds of strict XHTML, though onMouseOver is deprecated, so Javascript kind of hoses the whole complience thing.<span id="more-12"></span></p>
<p>This leads us to the topic at hand: accessibility.  Considering that HTML and XHTML are used for simply describing data, why would a page be more or less accessible?  Well, let&#8217;s think about that kid that has MS, but still needs to get online research done for a class he&#8217;s taking, or better yet, consider Stephen Hawking.  Do you think that they would be particularly amused if they had to fill out a form and had to be pixel precise to click on the input field?  I promise you they wouldn&#8217;t.</p>
<p>Accessibility means that regardless of the browser or disability, your page should still be reasonably functional.  Now, this does not mean that your page should read minds, but there are some tags that should be very familiar. Learn and use the following:</p>
<p>&lt;acronym&gt; &#8211; The acronym tag describes what an acronym means.  Hover your mouse pointer over the first instance of HTML, XHTML, SGML and DTD.  The full name will pop up.  In some screen readers the full text will replace the acronym so that the human can interpret what the acronym means.</p>
<p>&lt;label&gt; &#8211; Label tags should be used with form inputs whenever possible.  This will ensure that your user will be able to click on either the form element or the associated text and the form element will gain focus.</p>
<p>&lt;noscript&gt; &#8211; Ok, if you have ever used Javascript, you are familiar with the &lt;script&gt; tag.  So, in contrast, the &lt;noscript&gt; tag surrounds what should happen if Javascript or other inline scripting language is disabled.</p>
<p>Aside from these few tags, you should also become familiar with the following attributes:</p>
<p>title &#8211; Title can be used on practically any element.  This should be used somewhat sparingly though, as using a title with an alt tag, for instance, could spell disaster for a screen reader which cannot interpret all of the attributes precisely as you might expect.</p>
<p>alt &#8211; EVERY IMAGE SHOULD HAVE AN ALT TAG!  No ifs ands or buts.  If the image is included in the page via the &lt;img&gt; tag, use an alt tag.  Furthermore, use descriptive alternate text.  img_21938740928374.jpg is not useful.   I will find out if you are doing this and I will stalk you in the night.  Alternate text doesn&#8217;t have to be perfect.  No two people are going to interpret it in precisely the same way, but if the image is of a bird in flight, use alternate text that says something like &#8220;bird in flight.&#8221;  People will understand enough to get by.</p>
<p>accesskey &#8211; The accesskey attribute sets the stage for people that are going to use the keyboard to navigate your site, or perhaps have a limited command set to work from.  This attribute enables people to use keyboard shortcuts to access form elements for their ease and convenience.  I recommend using this tag in your forms in general, though I strongly urge you to add accesskey to any form elements that a disabled user might be looking to use.</p>
<p>Moving forward, let&#8217;s discuss the &lt;noscript&gt; tag.  Whenever you have a Javascript effect on your site, consider whether there would be a problem if there were no Javascript enabled.  As a matter of fact, go to your site, turn off Javascript in the options and try navigating.  If your site topples like a house of cards, you need to re-work your Javascript.  I currently work for a company whose previous web-person didn&#8217;t account for people with no Javascript.  The corporate site is totally unnavigable without Javascript.  This is bad.  This is really bad.</p>
<p>Ensure that your scripts degrade gracefully.  If you have elements that are hidden from the user until the Javascript function is triggered, what happens if scripts are disabled?  I always run a special function at the end of the page that hides the elements I want hidden.  What this translates to is, if you have scripts disabled, the page displays everything.  The failsafe for my scripts is usability.</p>
<p>This brings us back to Lynx.  Don&#8217;t think that I had forgotten.  I browse my sites using Lynx.  I do this so that I can see what happens when nothing is viewable but text.  Lynx doesn&#8217;t even give any particular kind of formatting.  Pages are just a long string of words.  If you can open your site like this and still find everything easily you have successfully made your site accessible.  If your page looks like an amorphous mess then you have some work to do.</p>
<p>Now, go forth and make the web a more usable place.</p>
<p>&copy;2012 <a href="http://www.chrisstead.com">Chris Stead</a>. All Rights Reserved.</p>.]]></content:encoded>
			<wfw:commentRss>http://www.chrisstead.com/archives/12/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Note to self, scope is important.</title>
		<link>http://www.chrisstead.com/archives/1</link>
		<comments>http://www.chrisstead.com/archives/1#comments</comments>
		<pubDate>Wed, 05 Dec 2007 05:30:20 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.chrisstead.com/?p=1</guid>
		<description><![CDATA[Being that this was an issue just last evening, I thought I would share something that I have encountered when writing Javascript scripts.  First of all, let me state that Javascript syntax is extremely forgiving.  You can do all kinds of  unorthodox declarations of variables as well as use variables in all kinds of strange [...]]]></description>
			<content:encoded><![CDATA[<p>Being that this was an issue just last evening, I thought I would share something that I have encountered when writing Javascript scripts.  First of all, let me state that Javascript syntax is extremely forgiving.  You can do all kinds of  unorthodox declarations of variables as well as use variables in all kinds of strange ways.  You can take a variable, store a string in it, then a number, then an object and then back again.  Weakly typed would be the phrase.  The one thing that I would like to note, as it was my big issue last evening, is scope of your variables.  So long as you are careful about defining the scope of any given variable then you are ok, if not, you could have a problem just like I did.  So, let&#8217;s start with scope and how it works.</p>
<p><strong>Scope</strong>: A mouthwash.  Yep.  There you have it.  Brush and floss every day and you&#8217;ll be a better programmer.</p>
<p>That&#8217;s useless.</p>
<p><strong>Scope</strong>: In computer programming in general, a scope is an enclosing context.<span id="more-1"></span></p>
<p>Ok, at least this one is accurate, though it doesn&#8217;t tell us a whole lot.  Really, the way that you can look at scope is &#8220;what parts of my program can access this element?&#8221;  I know that &#8220;element&#8221; is a little vague, but you can have scope that refers to objects, variables, functions, classes and a whole set of &#8220;elements.&#8221;  You see why I chose the word.  What I am concerned with here is the scope of a variable.</p>
<p>So, how do we reconcile this in programming terms?  Well, a variable can be a global, i.e. it can be accessed by anything.  Global variables are bad and should be eliminated with impunity.  I recommend a pistol.  Seriously, though, if you have a global variable that is storing anything that might be more than garbage text, you should probably find some other solution for your data storage needs.</p>
<p>Object scope.  This is much more limited.  Generally in an object you want to kind of tuck the variables away so that people don&#8217;t fool with your program.  Anything that is tucked into an object and set as private or protected will serve you well, grasshopper.  With any variable that is private or protected in an object you&#8217;ll need to write a get and a set method/function for it.  Just something that should be said</p>
<p>Function scope and finer grain scope.  Variables that are explicitly defined in a function are available to the entire function from the definition of the variable onward.  Variables that are defined in a for loop, though, are available only in the loop.  This being said, if you define a variable for use in a loop like so &#8220;for(var i=0; i&lt;&#8230;&#8221; the scope is limited, however if you define a variable as such: &#8220;while(true){var i=0&#8230;&#8221; then &#8216;i&#8217; will be available outside of the loop, in other parts of the function.  This is a very important distinction.</p>
<p>Quick thoughts on &#8220;while(true)&#8230;&#8221;  Don&#8217;t do it.  Seriously.  Bad idea.  Bad bozo, no cookie!</p>
<p>So, now the problem that I ran into.  Javascript will allow you to declare a variable thusly: &#8220;i=5&#8243; and it is fine with that.  If there is no prior instance of the variable &#8216;i&#8217; then a global will be created.  If there is a prior variable that is accessible, it will overwrite the current value of &#8216;i&#8217; as it should.  If there is a variable &#8216;i&#8217; that is limited in scope and inaccessible by the current operating function, a global will be created.  This is important to know when you are doing things like writing recursive functions.</p>
<p>Recursion leads us directly to the problem I had last night.  I was working on a recursive function that had a loop with an incremental counter.  I just went with &#8220;for(i=0; i&lt;other_var; i++){&#8230;&#8221;  I seemed to recall that if you declared a variable this way you would still have a nice, tight little for-loop scope to work with and you wouldn&#8217;t interfere with other functions or instances of the recursion.  I was wrong.  This kind of error is somewhat invisible.  This took a while to figure out.  The way I should have done, and ended up doing this is &#8220;for(var i=0; i&lt;other_var; i++){&#8230;&#8221; Please note the added &#8216;var.&#8217;  This will fix the scope issue and my code ran without a hitch.  Fun!  So, with that in mind, kids, remember to scope your variables properly or you might find yourself in a sticky situation.  Good luck and good web work!</p>
<p>&copy;2012 <a href="http://www.chrisstead.com">Chris Stead</a>. All Rights Reserved.</p>.]]></content:encoded>
			<wfw:commentRss>http://www.chrisstead.com/archives/1/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

