<?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>blog.paulgueller.com &#187; HTML/CSS</title>
	<atom:link href="http://blog.paulgueller.com/category/web/html-css/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.paulgueller.com</link>
	<description>Web Development Resources</description>
	<lastBuildDate>Mon, 21 Sep 2009 14:19:34 +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>Toggle Text Field Values with jQuery</title>
		<link>http://blog.paulgueller.com/2009/09/18/toggle-text-field-values-with-jquery/</link>
		<comments>http://blog.paulgueller.com/2009/09/18/toggle-text-field-values-with-jquery/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 17:00:09 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[examples]]></category>
		<category><![CDATA[forms]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[semantic web]]></category>
		<category><![CDATA[snippets]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://blog.paulgueller.com/?p=176</guid>
		<description><![CDATA[I saw this post on the CSS Tricks Snippet Feed which addresses a commonly desired form behavior: to provide default text in an INPUT element that disappears when the user enters that field. The example provided works, but I have a couple issues with it: Uses inline JavaScript, and must be reapplied to each element [...]]]></description>
			<content:encoded><![CDATA[<p>I saw <a title="Clear Field on Focus" href="http://css-tricks.com/snippets/javascript/clear-field-on-focus/">this post</a> on the <a title="CSS Tricks Snippet Feed | Yahoo! Pipes" href="http://feeds.feedburner.com/CSS-TricksSnippets">CSS Tricks Snippet Feed</a> which addresses a commonly desired form behavior: to provide default text in an <kbd>INPUT</kbd> element that disappears when the user enters that field. The example provided works, but I have a couple issues with it:</p>
<ol>
<li>Uses inline JavaScript, and must be reapplied to each element affected</li>
<li>Repeats the contents of the <kbd>value</kbd> attribute</li>
<li>The default text is not replaced if the user exits the field without entering new data</li>
</ol>
<p>So I created a possible solution, using jQuery:</p>
<h3>HTML</h3>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
</pre></td><td class="code"><pre class="html4strict" style="font-family:monospace;"><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;Place default text here&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span></pre></td></tr></table></div>

<h3>JavaScript</h3>

<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
</pre></td><td class="code"><pre class="javascript" style="font-family:monospace;">jQuery<span style="color: #009900;">&#40;</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>
  $<span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">'input[type=&quot;text&quot;]'</span> <span style="color: #009900;">&#41;</span>.<span style="color: #660066;">each</span><span style="color: #009900;">&#40;</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>
    $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">'title'</span><span style="color: #339933;">,</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
      .<span style="color: #000066;">focus</span><span style="color: #009900;">&#40;</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>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'title'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">''</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: #000066;">blur</span><span style="color: #009900;">&#40;</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>
        <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">''</span> <span style="color: #339933;">||</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">' '</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
          $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">val</span><span style="color: #009900;">&#40;</span> $<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">attr</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'title'</span><span style="color: #009900;">&#41;</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> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p></p>
<p>This script first iterates over each of the text input to assign a semantic text attribute, helpful not only in storing the default value, but also providing a tool-tip for reference as the user interacts with the page. It then assigns behaviors for both the <kbd>onfocus</kbd> and <kbd>onblur</kbd> events, eliminating the need to respecify data for comparison. The script is cleanly separated from the markup and, using jQuery, additional specifications may be made so as to only affect children of a particular <kbd>FIELDSET</kbd> or only those that possess a certain class.</p>
<p>I hope you find this snippet useful, and feel free to comment if you have additional information to share.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.paulgueller.com/2009/09/18/toggle-text-field-values-with-jquery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Visualize Your Markup with Processing</title>
		<link>http://blog.paulgueller.com/2008/12/20/visualize-your-markup-with-processing/</link>
		<comments>http://blog.paulgueller.com/2008/12/20/visualize-your-markup-with-processing/#comments</comments>
		<pubDate>Sun, 21 Dec 2008 05:26:13 +0000</pubDate>
		<dc:creator>Paul</dc:creator>
				<category><![CDATA[HTML/CSS]]></category>
		<category><![CDATA[Web]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[markup]]></category>
		<category><![CDATA[processing]]></category>
		<category><![CDATA[visualization]]></category>

		<guid isPermaLink="false">http://blog.paulgueller.com/?p=42</guid>
		<description><![CDATA[Developer Aharef provides an applet that graphically represents the elements in a web page's document structure.]]></description>
			<content:encoded><![CDATA[<p style="text-align: left;">I recently discovered an <a title="Websites as graphs" href="http://www.aharef.info/static/htmlgraph/">interesting applet</a> developed by Aharef in 2006 that uses the <a title="Software sketchbook and professional production tool" href="http://www.processing.org/">Processing</a> programming language to graph the element tree of a given web page.</p>
<p style="text-align: left;">For instance the current markup on this site gets rendered like this:</p>
<div class="mceTemp mceIEcenter" style="text-align: left;">
<dl id="attachment_44" class="wp-caption aligncenter" style="width: 310px;">
<dt class="wp-caption-dt"><a href="http://www.aharef.info/static/htmlgraph/?url=http%3A%2F%2Fblog.paulgueller.com"><img class="size-medium wp-image-44" title="Webpages as graphs: An HTML DOM Visualizer Applet" src="http://blog.paulgueller.com/wp-content/uploads/2008/12/htmlgraph-300x300.jpg" alt="An HTML DOM Visualizer Applet" width="300" height="300" /></a></dt>
<dd class="wp-caption-dd">Graph of <kbd>http://blog.paulgueller.com</kbd></dd>
</dl>
<p><a href="http://www.aharef.info/static/htmlgraph/"></a></div>
<p style="text-align: left;">According to the documentation and <a title="Posted screenshots of the code at work" href="http://www.aharef.info/2006/05/websites_as_graphs.htm">examples</a>, the colors represent:</p>
<ul style="text-align: left;">
<li><span style="color: #000099; font-weight: bold;">blue</span>: links (the <code>A</code> tag)</li>
<li><span style="color: #ff0000; font-weight: bold;">red</span>: tables (<code>TABLE</code>, <code>TR</code> and <code>TD</code> tags)</li>
<li><span style="color: #009900; font-weight: bold;">green</span>: <code>DIV</code> tags</li>
<li><span style="color: #cc00ff; font-weight: bold;">violet</span>:  images (the <code>IMG</code> tag)</li>
<li><span style="color: #ffff33; font-weight: bold;">yellow</span>: forms (<code>FORM</code>, <code>INPUT</code>, <code>TEXTAREA</code>, <code>SELECT</code> and <code>OPTION</code> tags)</li>
<li><span style="color: #ff9933; font-weight: bold;">orange</span>: linebreaks and blockquotes (<code>BR</code>, <code>P</code>, and <code>BLOCKQUOTE</code> tags)</li>
<li><span style="color: #000000; font-weight: bold;">black</span>: the <code>HTML</code> tag, the root node</li>
<li><span style="color: #999999; font-weight: bold;">gray</span>: all other tags</li>
</ul>
<p style="text-align: left;">Processing is an open-source programming language and development environment used for prototyping and producing images, animation, and interactions within a visual context. The code-graphing applet requires Java, but <a title="John Resig's port of Processing to JavaScript" href="http://ejohn.org/blog/processingjs/">processing.js</a> has made the language more widely accessible and available for experimentation.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.paulgueller.com/2008/12/20/visualize-your-markup-with-processing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
