<?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>Barryvan &#187; HTML</title>
	<atom:link href="http://www.barryvan.com.au/tag/html/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.barryvan.com.au</link>
	<description>Music, Programming, Design</description>
	<lastBuildDate>Sun, 08 Jan 2012 08:48:12 +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-generated tables and rowspan</title>
		<link>http://www.barryvan.com.au/2009/04/javascript-generated-tables-and-rowspan/</link>
		<comments>http://www.barryvan.com.au/2009/04/javascript-generated-tables-and-rowspan/#comments</comments>
		<pubDate>Thu, 16 Apr 2009 10:24:43 +0000</pubDate>
		<dc:creator>Barry van Oudtshoorn</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[MooTools]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[browsers]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://www.barryvan.com.au/?p=130</guid>
		<description><![CDATA[At work, I&#8217;ve recently been putting together a nice little calendar-like utility using Javascript. Basically, it has to generate a table consisting of cells which may span multiple rows. Surely the solution is simple enough: just set the rowspan on each td as we create it. Unfortunately, that doesn&#8217;t work, at least not in Firefox. [...]]]></description>
			<content:encoded><![CDATA[<p>At work, I&#8217;ve recently been putting together a nice little calendar-like utility using Javascript. Basically, it has to generate a table consisting of cells which may span multiple rows. Surely the solution is simple enough: just set the <em>rowspan</em> on each <em>td</em> as we create it. Unfortunately, that doesn&#8217;t work, at least not in Firefox.</p>
<p>It appears that in Firefox, if you create a <em>td</em> and set its <em>rowspan</em> to some value <strong>when there are no rows for it to expand into</strong>, the attribute will be completely ignored, <strong>even if you add rows afterwards</strong>! Needless to say, this is very annoying. The solution? Build your table backwards.</p>
<p>The code I have now is something like this (note that I&#8217;m developing using the Mootools framework):</p>
<pre class="brush: javascript">var tbl = new Element(&#039;table&#039;);
var trs = new Array();

for (var i = 0; i &lt; 4; i++) {
  var tr = new Element(&#039;tr&#039;);
  tr.grab(new Element(&#039;td&#039;, {
    &#039;html&#039;: &#039;Cell &#039; + i
  }));
  if (i % 2 == 0) {
    tr.grab(new Element(&#039;td&#039;, {
      &#039;rowspan&#039;: 2,
      &#039;html&#039;: &#039;Span &#039; + (i / 2)
    }));
  }
  trs.push(tr);
}

for (var i = trs.length - 1; i &gt;= 0; i--) {
  tbl.grab(trs[i], &#039;top&#039;);
}</pre>
<p>What does this code do? Well basically, we&#8217;re creating a table with ten rows and two columns; the cells in the right-hand column each occupy two rows. The result will be something like this:</p>
<table style="border:solid 1px blue;width:50%;">
<tr>
<td style="border:solid 1px black;">Cell 1</td>
<td rowspan="2" style="border:solid 1px red;">Span 1</td>
</tr>
<tr>
<td style="border:solid 1px black;">Cell 2</td>
</tr>
<tr>
<td style="border:solid 1px black;">Cell 3</td>
<td rowspan="2" style="border:solid 1px red;">Span 2</td>
</tr>
<tr>
<td style="border:solid 1px black;">Cell 4</td>
</tr>
</table>
]]></content:encoded>
			<wfw:commentRss>http://www.barryvan.com.au/2009/04/javascript-generated-tables-and-rowspan/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>HTML Entity Reference</title>
		<link>http://www.barryvan.com.au/2009/03/html-entity-reference/</link>
		<comments>http://www.barryvan.com.au/2009/03/html-entity-reference/#comments</comments>
		<pubDate>Fri, 20 Mar 2009 01:16:07 +0000</pubDate>
		<dc:creator>Barry van Oudtshoorn</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web design]]></category>

		<guid isPermaLink="false">http://www.barryvan.com.au/?p=122</guid>
		<description><![CDATA[What&#8217;sMyIP.org have a fantastic HTML Entity Reference which can optionally display every single character known to man (or seemingly so). It&#8217;s the most exhaustive and well-presented entity reference chart I&#8217;ve found on the web, so I thought it was worth pointing it out.]]></description>
			<content:encoded><![CDATA[<p><a href="http://whatsmyip.org">What&#8217;sMyIP.org</a> have a fantastic <a href="http://www.whatsmyip.org/htmlcharacters/">HTML Entity Reference</a> which can optionally display every single character known to man (or seemingly so). It&#8217;s the most exhaustive and well-presented entity reference chart I&#8217;ve found on the web, so I thought it was worth pointing it out.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.barryvan.com.au/2009/03/html-entity-reference/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Cross-browser div focus and blur</title>
		<link>http://www.barryvan.com.au/2009/01/onfocus-and-onblur-for-divs-in-fx/</link>
		<comments>http://www.barryvan.com.au/2009/01/onfocus-and-onblur-for-divs-in-fx/#comments</comments>
		<pubDate>Sun, 11 Jan 2009 13:28:21 +0000</pubDate>
		<dc:creator>Barry van Oudtshoorn</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[blur]]></category>
		<category><![CDATA[browser]]></category>
		<category><![CDATA[div]]></category>
		<category><![CDATA[focus]]></category>
		<category><![CDATA[onblur]]></category>
		<category><![CDATA[onfocus]]></category>
		<category><![CDATA[popup]]></category>

		<guid isPermaLink="false">http://barryvan.com.au/wp/?p=66</guid>
		<description><![CDATA[Internet Explorer has for some time supported giving &#8216;focus&#8217; to non-focussable elements such as divs. Firefox, by contrast, does not. Whilst this makes sense semantically, it&#8217;s often still very useful to use these triggers. For example, you can use onfocus to show a popup when a div is clicked, and close the popup when anything [...]]]></description>
			<content:encoded><![CDATA[<p>Internet Explorer has for some time supported giving &#8216;focus&#8217; to non-focussable elements such as <code>div</code>s. Firefox, by contrast, does not. Whilst this makes sense semantically, it&#8217;s often still very useful to use these triggers. For example, you can use <code>onfocus</code> to show a popup when a div is clicked, and close the popup when anything else is clicked on the page (in the <code>onblur</code> event).</p>
<p>There are many, many workarounds which provide this functionality, using such tricks as hidden input elements, global <code>onclick</code> handlers, and so on, but the simplest is simply this: <em>give your <code>div</code> a <code>tabIndex</code> attribute</em>. For example,</p>
<div><code>&lt;div tabindex="-1" onfocus="document.getElementById('monkey').style.display='block'" onblur="document.getElementById('monkey').style.display='none'"&gt;Click to show another div.&lt;/div&gt;<br />
&lt;div id="monkey" style="display:none;"&gt;Click elsewhere to hide this div.&lt;/div&gt;<br />
</code></div>
<p>works perfectly in Firefox, Internet Explorer, and Chrome as shown in the example below:</p>
<div style="background-color:#080808;border:solid 1px #222222;padding:4px;margin-left:64px;margin:8px;margin-right:64px;color:#dddddd;" onfocus="document.getElementById('monkey').style.display='block'" onblur="document.getElementById('monkey').style.display='none'" tabIndex="-1">Click to show another div.</div>
<div id="monkey" style="background-color:#222222;border:solid 1px #444444;display:none;padding:4px;margin-bottom:8px;margin-left:64px;margin-right:64px;color:#dddddd;">Click elsewhere to hide this div.</div>
<p>The value of <code>tabIndex</code> can have significance, too:</p>
<ul>
<li><strong>-1</strong>: The user can&#8217;t tab to the element, but it can be given focus programmatically (<code>element.focus()</code>) or by being clicked on.</li>
<li><strong>0</strong>: The user can tab to the element, and its order in the tabbing is automatically determined.</li>
<li><strong>&gt;0</strong>: Give the element a priority, with &#8217;1&#8242; being the highest priority.</li>
</ul>
<p>I originally discovered this technique on <a href="http://codingforums.com/showthread.php?t=134792" target="_blank">this CodingForums.com thread</a>.</p>
<div><strong>Supporting browsers:</strong></div>
<ul>
<li>Firefox</li>
<li>Internet Explorer</li>
<li>Google Chrome</li>
</ul>
<div><strong>Non-supporting browsers:</strong></div>
<ul>
<li>Safari</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.barryvan.com.au/2009/01/onfocus-and-onblur-for-divs-in-fx/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

