<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>SeriousCoding.com</title>
	
	<link>http://seriouscoding.com</link>
	<description>Because we care about our code!</description>
	<lastBuildDate>Sat, 22 Oct 2011 06:00:39 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/seriouscoding" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="seriouscoding" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>IE doesn’t fire change event with jQuery 1.4.1</title>
		<link>http://seriouscoding.com/2010/02/11/ie-doesnt-fire-change-event-with-jquery-1-4-1/</link>
		<comments>http://seriouscoding.com/2010/02/11/ie-doesnt-fire-change-event-with-jquery-1-4-1/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 18:46:41 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[eventhandling]]></category>
		<category><![CDATA[internetexplorer]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://random-signals.de/seriouscoding/?p=4</guid>
		<description><![CDATA[I just stumbled over a really annoying bug in jQuery 1.4.1. Internet Explorer 7 and 8 didn&#8217;t fire any change event on my text boxes. At least till one other change event from a radio button or drop down list was triggered before. Fortunately I wasn&#8217;t the first one to discover the bug and John has [...]]]></description>
			<content:encoded><![CDATA[<p>I just stumbled over a really annoying bug in jQuery 1.4.1. Internet Explorer 7 and 8 didn&#8217;t fire any change event on my text boxes. At least till one other change event from a radio button or drop down list was triggered before. Fortunately I wasn&#8217;t the first one to discover the <a href="http://dev.jquery.com/ticket/5851">bug</a> and John has already commited a <a href="http://github.com/jquery/jquery/commit/942f8f7f75a55a36e6b9745030d3b3c983518aa8">bugfix</a> to git. So the problem will be gone with version 1.4.2.</p>
<p>If you don&#8217;t want to or can&#8217;t wait for the next version, you can easily fix your current <code>jquery.js</code> file. Go to line 2255 and look for the <code>beforeactivate</code> function. The <code>if</code>-clause limits the initial data storage for change events to radio buttons. That&#8217;s why the other change events won&#8217;t be registered in IE. Remove the <code>if</code>-clause and everything will work again.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>2255
2256
2257
2258
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">beforeactivate<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
  <span style="color: #003366; font-weight: bold;">var</span> elem <span style="color: #339933;">=</span> e.<span style="color: #660066;">target</span><span style="color: #339933;">;</span>
  jQuery.<span style="color: #660066;">data</span><span style="color: #009900;">&#40;</span>elem<span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;_change_data&quot;</span><span style="color: #339933;">,</span> getVal<span style="color: #009900;">&#40;</span>elem<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://seriouscoding.com/2010/02/11/ie-doesnt-fire-change-event-with-jquery-1-4-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery 1.4 Cheat Sheet</title>
		<link>http://seriouscoding.com/2010/01/25/jquery-1-4-cheat-sheet/</link>
		<comments>http://seriouscoding.com/2010/01/25/jquery-1-4-cheat-sheet/#comments</comments>
		<pubDate>Mon, 25 Jan 2010 18:47:05 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[cheatsheet]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://random-signals.de/seriouscoding/?p=6</guid>
		<description><![CDATA[Impulse Studio Labs has produced the first cheat sheet I&#8217;ve found for the new version of jQuery. It&#8217;s printer-friendly, fits on one page, marks all the new or changed functions and I don&#8217;t think they missed anything important.]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="aligncenter size-full wp-image-41" title="jQuery 1.4 cheat sheet" src="http://seriouscoding.com/wp-content/uploads/2010/01/jquery-cheet-sheet.jpg" alt="" width="523" height="144" /></p>
<p>Impulse Studio Labs has produced the <a href="http://labs.impulsestudios.ca/jquery-cheat-sheet">first cheat sheet</a> I&#8217;ve found for the new version of jQuery. It&#8217;s printer-friendly, fits on one page, marks all the new or changed functions and I don&#8217;t think they missed anything important.</p>
]]></content:encoded>
			<wfw:commentRss>http://seriouscoding.com/2010/01/25/jquery-1-4-cheat-sheet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting rid of auto-generated .Net ids, kind of…</title>
		<link>http://seriouscoding.com/2010/01/18/getting-rid-of-auto-generated-net-ids-kind-of/</link>
		<comments>http://seriouscoding.com/2010/01/18/getting-rid-of-auto-generated-net-ids-kind-of/#comments</comments>
		<pubDate>Mon, 18 Jan 2010 18:47:12 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[.Net]]></category>

		<guid isPermaLink="false">http://random-signals.de/seriouscoding/?p=7</guid>
		<description><![CDATA[One of the most annoying &#8220;features&#8221; of the current .Net versions is the automatic generation of the ids for server controls. I&#8217;m doing a lot of my work with JavaScript and especially with jQuery, so these unpredictable ids make the selection of elements not only difficult, but also really slow. Most of the time it&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>One of the most annoying &#8220;features&#8221; of the current .Net versions is the automatic generation of the ids for server controls. I&#8217;m doing a lot of my work with JavaScript and especially with jQuery, so these unpredictable ids make the selection of elements not only difficult, but also really slow.</p>
<p>Most of the time it&#8217;s pretty easy to avoid server controls, but if you want to relay information from the server to the client at startup, you are usually stuck with WebControls like Literals or HTML controls for hidden fields.</p>
<p>At least that was what I thought till I stumbled upon a command to create hidden fields without these horrible long ids in a separate div container right after the form tag:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;">ClientScript<span style="color: #008000;">.</span><span style="color: #0000FF;">RegisterHiddenField</span><span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span> id, <span style="color: #6666cc; font-weight: bold;">string</span> value<span style="color: #008000;">&#41;</span></pre></div></div>

<p>I usually create my fields in <code>Page_Load</code> like this:</p>

<div class="wp_syntax"><div class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System.Web.UI</span><span style="color: #008000;">;</span>
  <span style="color: #008000;">...</span>
  <span style="color: #0600FF; font-weight: bold;">protected</span> <span style="color: #0600FF; font-weight: bold;">override</span> <span style="color: #6666cc; font-weight: bold;">void</span> Page_Load<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#123;</span>
      ClientScriptManager csm <span style="color: #008000;">=</span> Page<span style="color: #008000;">.</span><span style="color: #0000FF;">ClientScript</span><span style="color: #008000;">;</span>
      csm<span style="color: #008000;">.</span><span style="color: #0000FF;">RegisterHiddenField</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;foo&quot;</span>, <span style="color: #666666;">&quot;1&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
      csm<span style="color: #008000;">.</span><span style="color: #0000FF;">RegisterHiddenField</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;bar&quot;</span>, <span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">.</span><span style="color: #0000FF;">Empty</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
  <span style="color: #008000;">&#125;</span></pre></div></div>

<p>This will create the following HTML code:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">form</span> ...&gt;</span>
  ...
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;hidden&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;foo&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;foo&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;1&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
      <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;hidden&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;bar&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;bar&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
  ...
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">form</span>&gt;</span></pre></div></div>

<p>Of course you won&#8217;t be able to read or manipulate the field later like a WebControl. And you have no control about the final placement on the page either. But that was never my intention and you can do whatever you want with the field in your JavaScript anyway.</p>
]]></content:encoded>
			<wfw:commentRss>http://seriouscoding.com/2010/01/18/getting-rid-of-auto-generated-net-ids-kind-of/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery 1.4 is out</title>
		<link>http://seriouscoding.com/2010/01/14/jquery-1-4-is-out/</link>
		<comments>http://seriouscoding.com/2010/01/14/jquery-1-4-is-out/#comments</comments>
		<pubDate>Thu, 14 Jan 2010 18:47:23 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[dojo]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://random-signals.de/seriouscoding/?p=8</guid>
		<description><![CDATA[I&#8217;ve been eagerly waiting for the next update on my favorite JavaScript library, jQuery. I haven&#8217;t done any testing, but the list of new features looks very promising: Major performance boost for often used functions like .html(), .remove() or .find(). You can pass functions now into even more setter functions and their return value will [...]]]></description>
			<content:encoded><![CDATA[<div class="posterous_autopost">
<p>I&#8217;ve been eagerly waiting for the next update on my favorite JavaScript library, <a href="http://jquery.com/">jQuery</a>. I haven&#8217;t done any testing, but the list of new features looks very promising:</p>
<div>
<ul>
<li>Major performance boost for often used functions like <code>.html()</code>, <code>.remove()</code> or <code>.find()</code>.</li>
<li>You can pass functions now into even more setter functions and their return value will be added to the appropriate attribute.</li>
<li>Many improvements in handling Ajax calls like support for Etags or auto-detection of <code>content-type</code>.</li>
<li>Quick element construction similar to <code>dojo.create</code>.</li>
<li>New events, focusin and <code>focusout</code>, and a new function <code>jQuery.proxy()</code> that makes handling this in events easier.</li>
<li>Many many more&#8230;</li>
</ul>
<div>You can get a quick <a href="http://api.jquery.com/category/version/1.4/">overview of the changes to the jQuery API</a> if you only want to see which functions have changed or have been added. Or you can go and celebrate the <a href="http://jquery14.com/">14 days of jQuery</a> with us. <a href="http://jquery14.com/day-01/jquery-14">The post for day one</a> gives us a complete and detailed explanation of all the improvements, additions and changes. I can only recommend to read it, it&#8217;s very informative and I hope I will be able to start working with the new version soon.</div>
</div>
</div>
]]></content:encoded>
			<wfw:commentRss>http://seriouscoding.com/2010/01/14/jquery-1-4-is-out/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Keyboard navigation with JavaScript and jQuery</title>
		<link>http://seriouscoding.com/2009/08/16/keyboard-navigation-with-javascript-and-jquery/</link>
		<comments>http://seriouscoding.com/2009/08/16/keyboard-navigation-with-javascript-and-jquery/#comments</comments>
		<pubDate>Sun, 16 Aug 2009 18:46:52 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[eventhandling]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://random-signals.de/seriouscoding/?p=5</guid>
		<description><![CDATA[I had to add functionality for keyboard navigation to my latest project at work recently. It started out with the need to disable the browser’s postback when someone hits ENTER in a formular. Of course more had to be added once our usability guy realized that theoretically eliminates the need for a mouse. The following [...]]]></description>
			<content:encoded><![CDATA[<p>I had to add functionality for keyboard navigation to my latest project at work recently. It started out with the need to disable the browser’s postback when someone hits <code>ENTER</code> in a formular. Of course more had to be added once our usability guy realized that theoretically eliminates the need for a mouse. The following example is a bit more basic though and covers only what’s need to understand the concepts.</p>
<p>First of all we have to register the event on the document. Unfortunately keypressed isn’t supported on all browsers and keyup is a little too late to prevent all browser functions so we have to go with keydown.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">keydown</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>event<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></pre></td></tr></table></div>

<p>For cross-browser compatibility two properties of the event need to be checked: event.keyCode and event.which.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>2
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">    <span style="color: #003366; font-weight: bold;">var</span> key <span style="color: #339933;">=</span> event.<span style="color: #660066;">keyCode</span> <span style="color: #339933;">||</span> event.<span style="color: #660066;">which</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>And the last thing you have to know is whether the focus is on a textbox or a textarea. Otherwise we can screw up the ability to edit text very easy if we work with <code>ENTER</code>, <code>DELETE</code> or <code>BACKSPACE</code>. The check is done by looking at event.target.type.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>3
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>event.<span style="color: #660066;">target</span>.<span style="color: #660066;">type</span> <span style="color: #339933;">!==</span> <span style="color: #3366CC;">'textarea'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span></pre></td></tr></table></div>

<p>For the rest of the example, let’s say we have three buttons on our page, selected by jQuery, which get shown and hidden dynamically according to the context: one back button, <code>$back</code>, one forward button, <code>$forward</code> and one button to submit the form, <code>$save</code>.</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">        <span style="color: #006600; font-style: italic;">//ENTER</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>key <span style="color: #339933;">===</span> <span style="color: #CC0000;">13</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #006600; font-style: italic;">//The button has to be visible to be used.</span>
            <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>$save.<span style="color: #000066; font-weight: bold;">is</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">':visible'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>  
                $save.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>  
            <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>$forward.<span style="color: #000066; font-weight: bold;">is</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">':visible'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>  
                $forward.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
            <span style="color: #006600; font-style: italic;">//Preventing any other action by the browser</span>
            <span style="color: #006600; font-style: italic;">//even if no button is visible  </span>
            <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>  
        <span style="color: #009900;">&#125;</span>
        <span style="color: #006600; font-style: italic;">//Not in a textarea or textbox</span>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>event.<span style="color: #660066;">target</span>.<span style="color: #660066;">type</span> <span style="color: #339933;">!==</span> <span style="color: #3366CC;">'text'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #006600; font-style: italic;">//BACKSPACE  </span>
            <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>key <span style="color: #339933;">===</span> <span style="color: #CC0000;">8</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #006600; font-style: italic;">//SHIFT is also pressed</span>
                <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>event.<span style="color: #660066;">shiftKey</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>$forward.<span style="color: #000066; font-weight: bold;">is</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">':visible'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        $forward.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
                    <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>$back.<span style="color: #000066; font-weight: bold;">is</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">':visible'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                        $back.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                    <span style="color: #009900;">&#125;</span>
                <span style="color: #009900;">&#125;</span>
                <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>That’s it, our application’s enhanced with a few simple keyboard commands.</p>
<p>A little tip at the end: To make your code easier to write and understand here’s a handy object maps the real key codes of the most important special keys to easy to use constants. Just put it in front of the rest of your code.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">var</span> keyCode <span style="color: #339933;">=</span> <span style="color: #009900;">&#123;</span>
  BACKSPACE<span style="color: #339933;">:</span> <span style="color: #CC0000;">8</span><span style="color: #339933;">,</span>
  CAPS_LOCK<span style="color: #339933;">:</span> <span style="color: #CC0000;">20</span><span style="color: #339933;">,</span>
  COMMA<span style="color: #339933;">:</span> <span style="color: #CC0000;">188</span><span style="color: #339933;">,</span>
  CONTROL<span style="color: #339933;">:</span> <span style="color: #CC0000;">17</span><span style="color: #339933;">,</span>
  <span style="color: #000066; font-weight: bold;">DELETE</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">46</span><span style="color: #339933;">,</span>
  DOWN<span style="color: #339933;">:</span> <span style="color: #CC0000;">40</span><span style="color: #339933;">,</span>
  END<span style="color: #339933;">:</span> <span style="color: #CC0000;">35</span><span style="color: #339933;">,</span>
  ENTER<span style="color: #339933;">:</span> <span style="color: #CC0000;">13</span><span style="color: #339933;">,</span>
  ESCAPE<span style="color: #339933;">:</span> <span style="color: #CC0000;">27</span><span style="color: #339933;">,</span>
  <span style="color: #000066;">HOME</span><span style="color: #339933;">:</span> <span style="color: #CC0000;">36</span><span style="color: #339933;">,</span>
  INSERT<span style="color: #339933;">:</span> <span style="color: #CC0000;">45</span><span style="color: #339933;">,</span>
  LEFT<span style="color: #339933;">:</span> <span style="color: #CC0000;">37</span><span style="color: #339933;">,</span>
  NUMPAD_ADD<span style="color: #339933;">:</span> <span style="color: #CC0000;">107</span><span style="color: #339933;">,</span>
  NUMPAD_DECIMAL<span style="color: #339933;">:</span> <span style="color: #CC0000;">110</span><span style="color: #339933;">,</span>
  NUMPAD_DIVIDE<span style="color: #339933;">:</span> <span style="color: #CC0000;">111</span><span style="color: #339933;">,</span>
  NUMPAD_ENTER<span style="color: #339933;">:</span> <span style="color: #CC0000;">108</span><span style="color: #339933;">,</span>
  NUMPAD_MULTIPLY<span style="color: #339933;">:</span> <span style="color: #CC0000;">106</span><span style="color: #339933;">,</span>
  NUMPAD_SUBTRACT<span style="color: #339933;">:</span> <span style="color: #CC0000;">109</span><span style="color: #339933;">,</span>
  PAGE_DOWN<span style="color: #339933;">:</span> <span style="color: #CC0000;">34</span><span style="color: #339933;">,</span>
  PAGE_UP<span style="color: #339933;">:</span> <span style="color: #CC0000;">33</span><span style="color: #339933;">,</span>
  PERIOD<span style="color: #339933;">:</span> <span style="color: #CC0000;">190</span><span style="color: #339933;">,</span>
  RIGHT<span style="color: #339933;">:</span> <span style="color: #CC0000;">39</span><span style="color: #339933;">,</span>
  SHIFT<span style="color: #339933;">:</span> <span style="color: #CC0000;">16</span><span style="color: #339933;">,</span>
  SPACE<span style="color: #339933;">:</span> <span style="color: #CC0000;">32</span><span style="color: #339933;">,</span>
  TAB<span style="color: #339933;">:</span> <span style="color: #CC0000;">9</span><span style="color: #339933;">,</span>
  UP<span style="color: #339933;">:</span> <span style="color: #CC0000;">38</span>  <span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://seriouscoding.com/2009/08/16/keyboard-navigation-with-javascript-and-jquery/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>How to access an iframe with jQuery</title>
		<link>http://seriouscoding.com/2009/05/22/how-to-access-an-iframe-with-jquery/</link>
		<comments>http://seriouscoding.com/2009/05/22/how-to-access-an-iframe-with-jquery/#comments</comments>
		<pubDate>Fri, 22 May 2009 18:47:33 +0000</pubDate>
		<dc:creator>Martin</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[iframes]]></category>
		<category><![CDATA[jquery]]></category>

		<guid isPermaLink="false">http://random-signals.de/seriouscoding/?p=9</guid>
		<description><![CDATA[Frames are bad and iframes are not much better, but sometimes you don’t have a choice. Two days ago I had to change classes in an element of an iframe. The normal way to do that with pure JavaScript would’ve been a bit tedious so I looked for an alternative provided by jQuery. The following [...]]]></description>
			<content:encoded><![CDATA[<p>Frames are bad and iframes are not much better, but sometimes you don’t have a choice. Two days ago I had to change classes in an element of an iframe. The normal way to do that with pure JavaScript would’ve been a bit tedious so I looked for an alternative provided by jQuery.</p>
<p>The following example shows some code somewhere within an iframe with the id <code>content</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>An example title<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>
Some text that isn't  particularly interesting...
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;back&quot;</span>&gt;</span>previous posts<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
  <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;forward&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;green&quot;</span>&gt;</span>next posts<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span></pre></div></div>

<p>Apparently the list entry for <em>next posts</em> has the styles for a green button. That’s the way it should look most of the time, but in some cases it has to be red instead. We have to remove the class for the green color and add one for red. Using jQuery that’s done in only one statement:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#content&quot;</span><span style="color: #009900;">&#41;</span>
  .<span style="color: #660066;">contents</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
  .<span style="color: #660066;">find</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#forward&quot;</span><span style="color: #009900;">&#41;</span>
  .<span style="color: #660066;">removeClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;green&quot;</span><span style="color: #009900;">&#41;</span>
  .<span style="color: #660066;">addClas</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;red&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>It’s that easy because of jQuery’s <code>contents()</code> function. Normally the function returns all child nodes from the matched elements, but in case of an iframe you get the whole document that’s loaded into the iframe. Now you can use <code>find()</code> to locate the elements you need to work with and that’s it.</p>
]]></content:encoded>
			<wfw:commentRss>http://seriouscoding.com/2009/05/22/how-to-access-an-iframe-with-jquery/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
	</channel>
</rss><!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Served from: seriouscoding.com @ 2013-04-12 10:21:11 -->
