<?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>Web Dev Bros &#187; HTML pur</title>
	<atom:link href="http://www.webdevbros.net/category/deutsche-artikel/html-pur/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.webdevbros.net</link>
	<description>hot talk about web development</description>
	<lastBuildDate>Thu, 20 Jan 2011 19:55:06 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Label-Element für checkboxen, radiobuttons, etc.</title>
		<link>http://www.webdevbros.net/2005/03/02/label-element-fur-checkboxen-radiobuttons-etc/</link>
		<comments>http://www.webdevbros.net/2005/03/02/label-element-fur-checkboxen-radiobuttons-etc/#comments</comments>
		<pubDate>Wed, 02 Mar 2005 10:09:03 +0000</pubDate>
		<dc:creator>Michal</dc:creator>
				<category><![CDATA[Deutsche Artikel]]></category>
		<category><![CDATA[HTML pur]]></category>

		<guid isPermaLink="false">http://www.webdevbros.net/2007/05/02/label-element-fur-checkboxen-radiobuttons-etc/</guid>
		<description><![CDATA[Zu einem Radiobutton oder einer Checkbox gehört meist ein Text, welcher die Funktion des Elements beschreibt. Wie man es bereits von windows-Applikationen gewohnt ist, bewirkt ein Klick auf den ja Text auch eine Selektion des dazugehörigen Elements (z.b. Radiobutton). Um das Ganze nun auch im Web zu realisieren bedarf es 1-2 Zeilen Javascript. Dachte ich [...]]]></description>
			<content:encoded><![CDATA[<p>Zu einem Radiobutton oder einer Checkbox gehört meist ein Text, welcher die Funktion des Elements beschreibt. Wie man es bereits von windows-Applikationen gewohnt ist, bewirkt ein Klick auf den ja Text auch eine Selektion des dazugehörigen Elements (z.b. Radiobutton).<br />
<span id="more-42"></span><br />
Um das Ganze nun auch im Web zu realisieren bedarf es 1-2 Zeilen Javascript. Dachte ich mir bisher immmer :) Nun zur meiner Überraschung kann man das auch ganz anders lösen! Nämlich mit einem LABEL-Element und dem FOR-attribute. Anbei ein Code-Snippet zur Veranschaulichung:</p>
<div class="igBar"><span id="lhtml-2"><a href="#" onclick="javascript:showCodeTxt('html-2'); return false;">PLAIN TEXT</a></span></div>
<div class="syntax_hilite"><span class="langName">HTML:</span>
<div id="html-2">
<div class="html">
<ol>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><a href="http://december.com/html/4/element/form.html"><span style="color: #000000; font-weight: bold;">&lt;form&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/input.html"><span style="color: #000000; font-weight: bold;">&lt;input</span></a> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"en"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"radio"</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"en"</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"lang"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/label.html"><span style="color: #000000; font-weight: bold;">&lt;label</span></a> <span style="color: #000066;">for</span>=<span style="color: #ff0000;">"en"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span>English vielleicht?<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/label&gt;</span></span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/br.html"><span style="color: #000000; font-weight: bold;">&lt;br</span></a>/<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/input.html"><span style="color: #000000; font-weight: bold;">&lt;input</span></a> <span style="color: #000066;">id</span>=<span style="color: #ff0000;">"de"</span> <span style="color: #000066;">type</span>=<span style="color: #ff0000;">"radio"</span> <span style="color: #000066;">value</span>=<span style="color: #ff0000;">"de"</span> <span style="color: #000066;">name</span>=<span style="color: #ff0000;">"lang"</span> /<span style="color: #000000; font-weight: bold;">&gt;</span></a></span></div>
</li>
<li style="font-weight: bold;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;">&nbsp; <span style="color: #009900;"><a href="http://december.com/html/4/element/label.html"><span style="color: #000000; font-weight: bold;">&lt;label</span></a> <span style="color: #000066;">for</span>=<span style="color: #ff0000;">"de"</span><span style="color: #000000; font-weight: bold;">&gt;</span></a></span>Deutsch vielleicht?<span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/label&gt;</span></span></div>
</li>
<li style="font-family: 'Courier New', Courier, monospace; color: black; font-weight: normal; font-style: normal;color:#767676;">
<div style="font-family: 'Courier New', Courier, monospace; font-weight: normal;"><span style="color: #009900;"><span style="color: #000000; font-weight: bold;">&lt;/form&gt;</span></span> </div>
</li>
</ol>
</div>
</div>
</div>
<p></p>
<p>Hab nicht gewusst, dass dies möglich ist. Macht den HTML jetzt noch übersichtlicher. Vorallem verhält es sich auch anders als eine selbstgeschriebene Lösung mit Javascript. Noch dazu der schöne Rahmen drumherum wenns selektiert wird. Siehe Screenshot:</p>
<p><img src='/wp-content/uploads/2007/05/label.gif' alt='HTML Labels' /></p>
<p>Kompatibilität kann ich noch nicht sagen. Habs im IE6 und im Firefox getestet. Funktioniert in beiden reibungslos. Der Rest (der browser) interessiert mich ehrlicherweise nicht so ;)</p>
<p><strong>Was ich grad bemerkt hab:</strong> Stellt man nun einen der obigen Radiobuttons auf <em>DISABLED</em>, wird auch das LABEL funktionsuntüchtig. Das find ich natürlich sehr toll!! Da ichs bis jetzt immer alles mir Javascript abgefangen hab.</p>
<div><table> <td><iframe src='http://digg.com/api/diggthis.php?w=new&amp;u=http://www.webdevbros.net/2005/03/02/label-element-fur-checkboxen-radiobuttons-etc/&amp;t=Label-Element+f%C3%BCr+checkboxen%2C+radiobuttons%2C+etc.&amp;s=normal' height='80' width='52' frameborder='0' scrolling='no'></iframe></td> <td><iframe src='http://www.reddit.com/button_content?newwindow=1&amp;url=http://www.webdevbros.net/2005/03/02/label-element-fur-checkboxen-radiobuttons-etc/&amp;title=Label-Element+f%C3%BCr+checkboxen%2C+radiobuttons%2C+etc.&amp;t=2 ' height='80' width='52' scrolling='no' frameborder='0' ></iframe></td> <td><iframe src='http://widgets.dzone.com/links/widgets/zoneit.html?url=http://www.webdevbros.net/2005/03/02/label-element-fur-checkboxen-radiobuttons-etc/&amp;title=Label-Element+f%C3%BCr+checkboxen%2C+radiobuttons%2C+etc.&amp;t=1 ' height='80' width='52' scrolling='no' frameborder='0' ></iframe></td> <td><script type="text/javascript"><!--yahooBuzzArticleHeadline=Label-Element+f%C3%BCr+checkboxen%2C+radiobuttons%2C+etc.;//--></script><script type="text/javascript" src="http://d.yimg.com/ds/badge2.js" badgetype=square></script></td> <td><script type="text/javascript">tweetmeme_url='http://www.webdevbros.net/2005/03/02/label-element-fur-checkboxen-radiobuttons-etc/'; tweetmeme_style = 'normal';; </script><script type="text/javascript" src="http://tweetmeme.com/i/scripts/button.js" ></script></td></table></div><!-- This is a HTML comment, it will not display in any page. Feel free to remove this comment if it cause any inconvenient to you.
	Thanks for using digg digg, please visit http://www.mkyong.com/blog/digg-digg-wordpress-plugin for any comments and ideas, 
	
    Author : Yong Mook Kim
    Website : http://www.mkyong.com
	-->]]></content:encoded>
			<wfw:commentRss>http://www.webdevbros.net/2005/03/02/label-element-fur-checkboxen-radiobuttons-etc/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

