<?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>Nicolas Kuttler &#187; HTML</title>
	<atom:link href="http://www.nkuttler.de/tag/html/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.nkuttler.de</link>
	<description>WordPress Services, IT Services</description>
	<lastBuildDate>Wed, 28 Jul 2010 23:49:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Change Typo3 template depending on column content</title>
		<link>http://www.nkuttler.de/2009/09/05/change-typo3-template-depending-on-column-content/</link>
		<comments>http://www.nkuttler.de/2009/09/05/change-typo3-template-depending-on-column-content/#comments</comments>
		<pubDate>Sat, 05 Sep 2009 07:33:02 +0000</pubDate>
		<dc:creator>nicolas</dc:creator>
				<category><![CDATA[Content Management]]></category>
		<category><![CDATA[howto]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[template]]></category>
		<category><![CDATA[Typo3]]></category>
		<category><![CDATA[typoscript]]></category>
		<category><![CDATA[usability]]></category>
		<category><![CDATA[Webdesign]]></category>

		<guid isPermaLink="false">http://www.nkuttler.de//?p=852</guid>
		<description><![CDATA[Let&#8217;s assume you don&#8217;t just want to inject some HTML if there is content in a column, but you want to use a completely different layout. This isn&#8217;t hard to accomplish, see the example: tmp.templateFile = COA tmp.templateFile &#123; 10 = COA 10 &#123; if.isFalse.numRows &#60; styles.content.getRight 10 = FILE 10 &#123; file = fileadmin/template/1col.html [...]]]></description>
			<content:encoded><![CDATA[<p>Let&#8217;s assume you don&#8217;t just want to <a href="http://www.nkuttler.de//2009/05/24/change-template-if-content-exists-in-typo3/">inject some HTML</a> if there is content in a column, but you want to use a completely different layout. This isn&#8217;t hard to accomplish, see the example:<span id="more-852"></span></p>

<div class="wp_syntax"><div class="code"><pre class="typoscript" style="font-family:monospace;">tmp<span style="color: #339933; font-weight: bold;">.</span>templateFile <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #990000; font-weight: bold;">COA</span>
tmp<span style="color: #339933; font-weight: bold;">.</span>templateFile <span style="color: #009900;">&#123;</span>
	<span style="color: #cc0000;">10</span> <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #990000; font-weight: bold;">COA</span>
	<span style="color: #cc0000;">10</span> <span style="color: #009900;">&#123;</span>
		<span style="font-weight: bold;">if</span><span style="color: #339933; font-weight: bold;">.</span>isFalse<span style="color: #339933; font-weight: bold;">.</span><span style="font-weight: bold;">numRows</span> <span style="color: #339933; font-weight: bold;">&lt;</span> <span style="color: #000066; font-weight: bold;">styles</span><span style="color: #339933; font-weight: bold;">.</span>content<span style="color: #339933; font-weight: bold;">.</span>getRight
		<span style="color: #cc0000;">10</span> <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #990000; font-weight: bold;">FILE</span>
		<span style="color: #cc0000;">10</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">file</span> <span style="color: #339933; font-weight: bold;">=</span> fileadmin<span style="color: #339933; font-weight: bold;">/</span>template<span style="color: #339933; font-weight: bold;">/</span>1col<span style="color: #339933; font-weight: bold;">.</span>html
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #cc0000;">20</span> <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #990000; font-weight: bold;">COA</span>
	<span style="color: #cc0000;">20</span> <span style="color: #009900;">&#123;</span>
		<span style="font-weight: bold;">if</span><span style="color: #339933; font-weight: bold;">.</span>isTrue<span style="color: #339933; font-weight: bold;">.</span><span style="font-weight: bold;">numRows</span> <span style="color: #339933; font-weight: bold;">&lt;</span> <span style="color: #000066; font-weight: bold;">styles</span><span style="color: #339933; font-weight: bold;">.</span>content<span style="color: #339933; font-weight: bold;">.</span>getRight
		<span style="color: #cc0000;">10</span> <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #990000; font-weight: bold;">FILE</span>
		<span style="color: #cc0000;">10</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">file</span> <span style="color: #339933; font-weight: bold;">=</span> fileadmin<span style="color: #339933; font-weight: bold;">/</span>template<span style="color: #339933; font-weight: bold;">/</span>2col<span style="color: #339933; font-weight: bold;">.</span>html
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The <tt>if</tt>s check if there is or isn&#8217;t content in the right column and the <tt>COA</tt> returns the correct cObject, FILE in this case.</p>
<p>And then in your main typoscript something like:</p>

<div class="wp_syntax"><div class="code"><pre class="typoscript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">page</span><span style="color: #339933; font-weight: bold;">.</span>10<span style="color: #339933; font-weight: bold;">.</span>template <span style="color: #339933; font-weight: bold;">&lt;</span> tmp<span style="color: #339933; font-weight: bold;">.</span>templateFile</pre></div></div>

<p>instead of the more usual</p>

<div class="wp_syntax"><div class="code"><pre class="typoscript" style="font-family:monospace;"><span style="color: #000066; font-weight: bold;">page</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #cc0000;">10</span> <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #990000; font-weight: bold;">TEMPLATE</span>
	<span style="color: #cc0000;">10</span> <span style="color: #009900;">&#123;</span>
		template <span style="color: #339933; font-weight: bold;">=</span> <span style="color: #990000; font-weight: bold;">FILE</span>
		template <span style="color: #009900;">&#123;</span>
			<span style="color: #000066; font-weight: bold;">file</span> <span style="color: #339933; font-weight: bold;">=</span> fileadmin<span style="color: #339933; font-weight: bold;">/</span>template<span style="color: #339933; font-weight: bold;">/</span>1col<span style="color: #339933; font-weight: bold;">.</span>html
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>That&#8217;s all.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nkuttler.de/2009/09/05/change-typo3-template-depending-on-column-content/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>My favorite Firefox Add-ons</title>
		<link>http://www.nkuttler.de/2009/08/25/my-favorite-firefox-add-ons/</link>
		<comments>http://www.nkuttler.de/2009/08/25/my-favorite-firefox-add-ons/#comments</comments>
		<pubDate>Tue, 25 Aug 2009 12:02:23 +0000</pubDate>
		<dc:creator>nicolas</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Webdesign]]></category>
		<category><![CDATA[xorg]]></category>

		<guid isPermaLink="false">http://www.nkuttler.de//?p=834</guid>
		<description><![CDATA[This is about the Firefox Add-ons I use. This really is a complete list, I like to keep my browser lean. I&#8217;m fully aware that most people will miss things like Adblock, Pixel perfect and greasemonkey, but I don&#8217;t use them. Usability Tab Kit: My favorite tab extension. Has many many features, I use it [...]]]></description>
			<content:encoded><![CDATA[<p>This is about the Firefox Add-ons I use. This really is a complete list, I like to keep my browser lean. I&#8217;m fully aware that most people will miss things like Adblock, Pixel perfect and greasemonkey, but I don&#8217;t use them.<span id="more-834"></span></p>
<a name="wptoc_0_0_0"></a><h2>Usability</h2>
<p><strong><a href="https://addons.mozilla.org/en-US/firefox/addon/5447">Tab Kit</a>:</strong> My favorite tab extension. Has many many features, I use it mostly because it allow more than one row of tabs and tab grouping/collapsing.</p>
<p><strong><a href="https://addons.mozilla.org/en-US/firefox/addon/2408">Clear Fields</a>:</strong> This solves a quite annoying issue with Firefox and the xorg clipboard. Xorgs lets you paste things that you have highlighted with the mouse by simply clicking the middle mouse button. However, the previous contents of the search and address fields don&#8217;t get cleared. This adds buttons to clear those fields before pasting.</p>
<a name="wptoc_0_0_1"></a><h2>Development and Webdesign</h2>
<p><strong><a href="https://addons.mozilla.org/en-US/firefox/addon/1843">Firebug</a>:</strong> The swiss army knife of web developer add-ons. To quote from it&#8217;s description: &#8220;You can edit, debug, and monitor CSS, HTML, and JavaScript live in any web page&#8221;. Very power- and useful.</p>
<p><strong><a href="https://addons.mozilla.org/en-US/firefox/addon/4904">Gridfox</a>:</strong> Indispensable while making grid-based layouts or aligning text to a base grid.</p>
<p><strong><a href="http://livehttpheaders.mozdev.org/">Live HTTP headers</a>:</strong> This is rather esoteric, but very useful for JavaScript debugging and web app development.</p>
<p><strong><a href="https://addons.mozilla.org/en-US/firefox/addon/60">Web Developer</a>:</strong> This is what I used before Firebug existed, and it&#8217;s still useful today.</p>
<p><strong><a href="https://addons.mozilla.org/en-US/firefox/addon/539">MeasureIt</a>:</strong>This is very useful for quickly measuring the size of various elements on a page.</p>
<a name="wptoc_0_0_2"></a><h2>Privacy/Security</h2>
<p><strong><a href="https://addons.mozilla.org/en-US/firefox/addon/4703">Cookie Monster</a>:</strong> The best cookie manager I could find. I always block all 3rd party cookies, and by default no website is allowed to store cookies on my computer. Cookie monster makes it very easy to allow cookies for sites I visit. Another nice feature is to only allow session cookies for some sites.</p>
<p><strong><a href="http://flashblock.mozdev.org/">Flashblock</a>:</strong> Blocks all annoying flash animations. Can whitelist sites of course. A must.</p>
<p><strong><a href="http://noscript.net/">NoScript</a>:</strong> Blocks all (3rd party) JavaScript. Indispensable security tool and gets rid of most ads as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nkuttler.de/2009/08/25/my-favorite-firefox-add-ons/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>About the nonsense of blocking and annoying IE6 users</title>
		<link>http://www.nkuttler.de/2009/03/02/about-the-nonsense-of-blocking-and-annoying-ie6-users/</link>
		<comments>http://www.nkuttler.de/2009/03/02/about-the-nonsense-of-blocking-and-annoying-ie6-users/#comments</comments>
		<pubDate>Mon, 02 Mar 2009 15:00:46 +0000</pubDate>
		<dc:creator>nicolas</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Webdesign]]></category>

		<guid isPermaLink="false">http://www.nkuttler.de//?p=674</guid>
		<description><![CDATA[I know why most people who do web design, JS coding etc. loathe Internet Explorer 6. I hate having to fix stuff for any IE at all, the web would be a better place if that piece of software just died. I welcome efforts to decrease the market share of IE6, I support nagging warnings [...]]]></description>
			<content:encoded><![CDATA[<p>I know why most people who do web design, JS coding etc. loathe Internet Explorer 6. I hate having to fix stuff for any IE at all, the web would be a better place if that piece of software just died. I welcome efforts to decrease the market share of IE6, I support nagging warnings for IE6 visitors. But what&#8217;s with these nonsensical ideas of <a href="http://www.browsesad.com/">making websites look worse</a> in it or <a href="http://www.stoplivinginthepast.com/get-the-code/comment-page-1/#comment-18">blocking it</a>?<span id="more-674"></span></p>
<p>There was a time when websites used &#8220;Best viewed in Internet Explorer&#8221; or &#8220;Best viewed in Netscape&#8221; kind of texts and banners. Some sites even blocked you if you were using the &#8216;wrong&#8217; browser (it still happens today). That was stupid in the 90s, and locking out IE6 isn&#8217;t any smarter today.</p>
<p>If you want to behave like the &#8220;Best viewed in Internet Explorer&#8221; crowd of the 90s just go ahead. There was a different movement back then that still exists today: <a href="http://www.anybrowser.org/campaign/">Viewable With Any Browser</a>. There&#8217;s really no need to punish some minority browsers.</p>
<blockquote><p>Anyone who slaps a &#8216;this page is best viewed with Browser X&#8217; label on a Web page appears to be yearning for the bad old days, before the Web, when you had very little chance of reading a document written on another computer, another word processor, or another network.</p></blockquote>
<p class="blockquote-src"><a href="http://www.w3.org/People/Berners-Lee/">Tim Berners-Lee</a> in Technology Review, July 1996</p>
<p>I guess I&#8217;ll just go on and build sites that are more or less standards-compliant and hopefully don&#8217;t require special tweaking for IE6. There are enough cross-browser tools out there. Just use your favorite search engine to find JavaScript libraries, CSS frameworks etc. Of course, something will always break in the old IEs, but don&#8217;t waste time breaking it on purpose.</p>
<p><b>Update</b>: Just found this gem from the gif-crazy 90s and had to add it:<br />
<a href="http://www.anybrowser.org/campaign/"><img src="http://www.nkuttler.de//files/2009/03/eye_eng.gif" alt="Best viewed with your eyes" width="100" height="35" class="alignnone size-full wp-image-704" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.nkuttler.de/2009/03/02/about-the-nonsense-of-blocking-and-annoying-ie6-users/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Opera and the &lt;noscript&gt; tag</title>
		<link>http://www.nkuttler.de/2008/12/27/opera-and-the-noscript-tag/</link>
		<comments>http://www.nkuttler.de/2008/12/27/opera-and-the-noscript-tag/#comments</comments>
		<pubDate>Sat, 27 Dec 2008 08:00:07 +0000</pubDate>
		<dc:creator>nicolas</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[opera]]></category>
		<category><![CDATA[usability]]></category>

		<guid isPermaLink="false">http://www.nkuttler.de//?p=476</guid>
		<description><![CDATA[When you build websites and test them in various browsers there always are some problems in some browsers. Usually it&#8217;s the one you expect who displays things incorrectly. But a few days ago I was surprised when Opera insisted on showing me the contents of a &#60;noscript&#62; tag. The solution to the problem was a [...]]]></description>
			<content:encoded><![CDATA[<p>When you build websites and test them in various browsers there always are some problems in some browsers. Usually it&#8217;s the one you expect who displays things incorrectly. But a few days ago I was surprised when Opera insisted on showing me the contents of a &lt;noscript&gt; tag<span id="more-476"></span>.<br />
The solution to the problem was a little surprising. To have users see a nice noscript message I had styled it through CSS. When I removed the styles Opera behaved. The line that triggered the display was</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span></pre></div></div>

<p>Other <tt>display</tt> configurations seem to create the same problem. Opera&#8217;s behaviour is incorrect, see <a href="http://www.w3.org/TR/REC-html40/interact/scripts.html#h-18.3.1">the specs</a> as <a href="http://www.earth.li/~dave/techie/blog/programming/html/OperaShowingNoscript.html">Dave</a> points out.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nkuttler.de/2008/12/27/opera-and-the-noscript-tag/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Ozh admin menu and WordPress 2.7</title>
		<link>http://www.nkuttler.de/2008/11/02/ozh-admin-drop-down-menu-and-wordpress-27/</link>
		<comments>http://www.nkuttler.de/2008/11/02/ozh-admin-drop-down-menu-and-wordpress-27/#comments</comments>
		<pubDate>Sun, 02 Nov 2008 01:58:00 +0000</pubDate>
		<dc:creator>nicolas</dc:creator>
				<category><![CDATA[Content Management]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://www.nkuttler.de//?p=369</guid>
		<description><![CDATA[I was anxious to finally try out the wordpress 2.7 beta. As a happy user of Ozh&#8217;s admin drop down menu I had to realize that the menus were completely gone in the backend. I was a little surprised, I guess more plugins will break. A fix, of course, is to simply remove ozh-admin-drop-down-menu from [...]]]></description>
			<content:encoded><![CDATA[<p>I was anxious to finally try out the wordpress 2.7 beta. As a happy user of Ozh&#8217;s <a href="http://planetozh.com/blog/my-projects/wordpress-admin-menu-drop-down-css/">admin drop down menu</a> I had to realize that the menus were completely gone in the backend.<span id="more-369"></span></p>
<p>I was a little surprised, I guess more plugins will break. A fix, of course, is to simply remove <tt>ozh-admin-drop-down-menu</tt> from your <tt>wordpress/wp-content/plugins/</tt> folder.</p>
<p>One of the things Ozh&#8217;s menu does is to look for the <tt>#adminmenu</tt> list and hide it. I&#8217;m not sure who&#8217;s the culprit here, the wordpress developers for not renaming their css class while doing such fundamental changes or Ozh for not checking the wordpress version. Well, it&#8217;s still a beta and maybe someone will include a better fix.</p>
<p>The new admin menu is kind of neat, but I think Ozh&#8217;s menu is far superior. We&#8217;ll see if Ozh <a href="http://planetozh.com/blog/2008/10/wordpress-27-is-killing-my-plugins-hooray/">changes his mind</a>.</p>
<p><b>Update</b>: The plugin has been updated and works fine in 2.7 now. I liked the old look better, but the improved usability and speed is what matters most to me.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nkuttler.de/2008/11/02/ozh-admin-drop-down-menu-and-wordpress-27/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mooified focus onload but keep backspace intact</title>
		<link>http://www.nkuttler.de/2008/10/02/mooified-focus-onload-but-keep-backspace-intact/</link>
		<comments>http://www.nkuttler.de/2008/10/02/mooified-focus-onload-but-keep-backspace-intact/#comments</comments>
		<pubDate>Thu, 02 Oct 2008 09:46:15 +0000</pubDate>
		<dc:creator>nicolas</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[onclick]]></category>
		<category><![CDATA[onfocus]]></category>
		<category><![CDATA[usability]]></category>

		<guid isPermaLink="false">http://www.nkuttler.de//?p=142</guid>
		<description><![CDATA[You may have heard about Harmen Janssen&#8217;s technique to focus input fields on pageload and keep the backspace button&#8217;s history back function intact. I wanted to play with it any my first step was to mooify his ideas. So inside the domready event I simply did: 1 2 3 4 5 6 7 8 9 [...]]]></description>
			<content:encoded><![CDATA[<p>You may have heard about Harmen Janssen&#8217;s technique to <a href="http://www.whatstyle.net/articles/51/focus_onload_but_keep_backspace_intact">focus input fields on pageload and keep the backspace button&#8217;s history back function intact</a>. I wanted to play with it any my first step was to <a href="http://www.mootools.net">mooify</a> his ideas.<span id="more-142"></span></p>
<p>So inside the domready event I simply did:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> inputify<span style="color: #009900;">&#40;</span>elem<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    elem.<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    elem.<span style="color: #660066;">addEvents</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #3366CC;">'keydown'</span><span style="color: #339933;">:</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>
            <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>event.<span style="color: #660066;">key</span> <span style="color: #339933;">===</span> <span style="color: #3366CC;">'backspace'</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span>elem.<span style="color: #660066;">value</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                history.<span style="color: #000066;">back</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: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
inputify<span style="color: #009900;">&#40;</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'SomeInputfieldById'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Great, reusable, everthing works fine. Ok, so let&#8217;s incorporate my ideas from my <a href="http://www.nkuttler.de//2008/09/20/html-forms-and-onclickonfocus/">HTML forms and onclick/onfocus</a> post (basically, select on click instead of focus and pre-fill the input field):</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;"><span style="color: #003366; font-weight: bold;">function</span> inputify<span style="color: #009900;">&#40;</span>elem<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #003366; font-weight: bold;">var</span> startvalue <span style="color: #339933;">=</span> elem.<span style="color: #660066;">value</span><span style="color: #339933;">;</span>
    elem.<span style="color: #660066;">select</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    elem.<span style="color: #660066;">addEvents</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #3366CC;">'keydown'</span><span style="color: #339933;">:</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>
            <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>event.<span style="color: #660066;">key</span> <span style="color: #339933;">===</span> <span style="color: #3366CC;">'backspace'</span> <span style="color: #339933;">&amp;&amp;</span> elem.<span style="color: #660066;">value</span> <span style="color: #339933;">===</span> startvalue<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                history.<span style="color: #000066;">back</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: #339933;">,</span>
        <span style="color: #3366CC;">'click'</span><span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            elem.<span style="color: #660066;">select</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: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
inputify<span style="color: #009900;">&#40;</span> $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'SomeInputfieldById'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Great works fine. Remember pre-filled value and only go back in history when the user hasn&#8217;t changed it. Done.</p>
<p>Wait&#8230; oh, noes! The backspace button is supposed to <span style="text-decoration: underline">delete</span> the input. Now, most users will unwillingly trigger the history back function. That&#8217;s as broken as it gets&#8230; Well, in theory I could focus the input field instead of selecting it, and use something like caretPos, and only go back in history if it&#8217;s at the start&#8230; But that&#8217;s not what I had in mind (well not sure <u>what</u> I was thinking anyway&#8230;)</p>
<p>So I consider this technique unusable for the time being for my own sites. The only times I focus some input field onload is for search functions anyway. There, I&#8217;d rather annoy a few users and improve the overall usability of the site. Like Harmen said in his post, don&#8217;t use onload input focus just because you can <img src='http://www.nkuttler.de/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.nkuttler.de/2008/10/02/mooified-focus-onload-but-keep-backspace-intact/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The biggest CSS annoyance</title>
		<link>http://www.nkuttler.de/2008/09/29/the-biggest-css-annoyance/</link>
		<comments>http://www.nkuttler.de/2008/09/29/the-biggest-css-annoyance/#comments</comments>
		<pubDate>Mon, 29 Sep 2008 16:30:44 +0000</pubDate>
		<dc:creator>nicolas</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[rant]]></category>
		<category><![CDATA[usability]]></category>
		<category><![CDATA[Webdesign]]></category>

		<guid isPermaLink="false">http://www.nkuttler.de//?p=20</guid>
		<description><![CDATA[I think this is one of the biggest design flaws, and I see it all the time when I surf the net. What surprises me is that I even see it on sites that have valid code, a nice design and offer valuable services. Seriously, how can somebody miss that his complete page layout shifts [...]]]></description>
			<content:encoded><![CDATA[<p>I think this is one of the biggest design flaws, and I see it all the time when I surf the net. What surprises me is that I even see it on sites that have valid code, a nice design and offer valuable services.<span id="more-20"></span></p>
<p>Seriously, how can somebody miss that his complete page layout shifts some pixels to the left or right when looking at different pages of the same site.</p>
<p>Consider this, twitter without a scrollbar (I think this was my profile page).</p>

<p>The same site, but now with a scrollbar. Notice how all the content moves to the left.</p>

<p>On the next image I made an overlay of both shots to make the layout shifting more obvious.</p>

<p>In my opinion this is one of the biggest design errors, and everybody does it. And &#8211; it&#8217;s ridiculously easy to fix:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">html <span style="color: #00AA00;">&#123;</span>
    overflow-y<span style="color: #00AA00;">:</span> <span style="color: #993333;">scroll</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>Not using this is really hurting a website&#8217;s usability. When a user clicks on some navigation element the navigation is supposed to be at the same place on the next page. So, force the vertical scroll bar!</p>
<p>Now I just need to hire myself a good designer to make my page look good <img src='http://www.nkuttler.de/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.nkuttler.de/2008/09/29/the-biggest-css-annoyance/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>HTML forms and onclick/onfocus</title>
		<link>http://www.nkuttler.de/2008/09/20/html-forms-and-onclickonfocus/</link>
		<comments>http://www.nkuttler.de/2008/09/20/html-forms-and-onclickonfocus/#comments</comments>
		<pubDate>Sat, 20 Sep 2008 08:34:39 +0000</pubDate>
		<dc:creator>nicolas</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[onclick]]></category>
		<category><![CDATA[onfocus]]></category>
		<category><![CDATA[usability]]></category>
		<category><![CDATA[Webdesign]]></category>

		<guid isPermaLink="false">http://www.nkuttler.de//?p=17</guid>
		<description><![CDATA[When you use HTML forms it is often desirable to pre-fill some input fields. Your idea could be that you want to give your visitors some clue to what they&#8217;re supposed to fill in.This looks nice, for example: When the user clicks into the field you&#8217;ll want to remove the clue. The obvious way to [...]]]></description>
			<content:encoded><![CDATA[<p>When you use HTML forms it is often desirable to pre-fill some input fields. Your idea could be that you want to give your visitors some clue to what they&#8217;re supposed to fill in.<span id="more-17"></span>This looks nice, for example:</p>
<form>
<input type="text" value="Your email" /></form>
<p>When the user clicks into the field you&#8217;ll want to remove the clue. The obvious way to do this is to add an onclick JavaScript command:</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;">input</span> <span style="color: #000066;">onclick</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;this.value=''&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Your email&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;">form</span>&gt;</span></pre></div></div>

<form>
<input onclick="this.value=''" type="text" value="Your email" /></form>
<p>The user can still access the input field through other means than clicking. He can use the tab key for example. That&#8217;s why usually the onfocus event is more useful:</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;">input</span> <span style="color: #000066;">onfocus</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;this.value=''&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Your email&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;">form</span>&gt;</span></pre></div></div>

<form>
<input onfocus="this.value=''" type="text" value="Your email" />
</form>
<p>This seems to work nicely. However there&#8217;s still a problem. When a user fills in his email address, reads a little more on your site and clicks the input field again, his address will be removed again! So to make sure this doesn&#8217;t happen we add a little check for the content of the field:</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;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Your email&quot;</span> <span style="color: #000066;">onfocus</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;if (this.value == 'Your email') {this.value=''}&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;">form</span>&gt;</span></pre></div></div>

<p>And here it is:</p>
<form>
<input type="text" value="Your email" onfocus="if (this.value == 'Your email') {this.value=''}" />
</form>
<a name="wptoc_0_0_0"></a><h2>Restore default value if nothing is entered</h2>
<p>Ok, now this is working. However, when your visitor decides not to input any data, the field stays empty. If you have no label for the input he or she might forget what the field was for. We fix this by restoring the default value when the input field is left:</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;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Your email&quot;</span> <span style="color: #000066;">onblur</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;if(this.value == '') { this.value='Your email'}&quot;</span> <span style="color: #000066;">onfocus</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;if (this.value == 'Your email') {this.value=''}&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;">form</span>&gt;</span></pre></div></div>

<form>
<input type="text" value="Your email" onblur="if(this.value == '') { this.value='Your email'}" onfocus="if (this.value == 'Your email') {this.value=''}" />
</form>
<p>Thanks to Ray for his example linked in the comments.</p>
<a name="wptoc_0_0_1"></a><h2>Select onclick</h2>
<p>But sometimes this isn&#8217;t the best solution. It could be more desirable to highlight the content of the input field if you&#8217;re offering some kind of search. The user may not want to start a new search but to modify the existing one.</p>
<p>By highlighting the input field the user can choose to either empy it by starting to type or to modify it by using the arrow keys.</p>
<form>
<input onfocus="this.select()" type="text" value="Your previous searcj" />
</form>

<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;">input</span> <span style="color: #000066;">onfocus</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;this.select()&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Your previous searcj&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;">form</span>&gt;</span></pre></div></div>

<a name="wptoc_0_0_2"></a><h2>Dynamic input color</h2>
<p>This is a little advanced. Let&#8217;s assume you want the default value to be in a different color and change it onclick. This is one working solution:</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;">input</span> <span style="color: #000066;">style</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;color: #f00&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Your email&quot;</span> <span style="color: #000066;">onblur</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;if(this.value == '') { this.style.color='#f00'; this.value='Your email'}&quot;</span> <span style="color: #000066;">onfocus</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;if (this.value == 'Your email') {this.style.color='#0f0'; this.value=''}&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;">form</span>&gt;</span></pre></div></div>

<form>
<input style="color: #f00" type="text" value="Your email" onblur="if(this.value == '') { this.style.color='#f00'; this.value='Your email'}" onfocus="if (this.value == 'Your email') {this.style.color='#0f0'; this.value=''}" />
</form>
<p>Keep in mind that this might create problems when you reload the page. Some browsers will remember the value of the input field, and the color will be different even though the field does not contain the default value. Fixing that is beyond the scope of this post. See <tt>onload</tt> and domready events.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.nkuttler.de/2008/09/20/html-forms-and-onclickonfocus/feed/</wfw:commentRss>
		<slash:comments>22</slash:comments>
		</item>
	</channel>
</rss>
