<?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>Open Source Web &#187; input</title>
	<atom:link href="http://www.open-source-web.com/tag/input/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.open-source-web.com</link>
	<description>Your open source for Development and Design</description>
	<lastBuildDate>Sun, 08 Jan 2012 10:21:46 +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 Input box control</title>
		<link>http://www.open-source-web.com/javascript/javascript-input-box-control/</link>
		<comments>http://www.open-source-web.com/javascript/javascript-input-box-control/#comments</comments>
		<pubDate>Mon, 12 Jan 2009 20:50:45 +0000</pubDate>
		<dc:creator>Adi</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[form]]></category>
		<category><![CDATA[input]]></category>

		<guid isPermaLink="false">http://www.open-source-web.com/?p=5</guid>
		<description><![CDATA[The idea behind this was to aid design and usability by adding a label inside the input box to give an indication of what it was for. It might not be a search box, maybe you want to add labels for name and address boxes who knows. Click the input box below and see how [...]]]></description>
			<content:encoded><![CDATA[<p>The idea behind this was to aid design and usability by adding a label inside the input box to give an indication of what it was for. It might not be a search box, maybe you want to add labels for name and address boxes who knows.</p>
<p>Click the input box below and see how the &#8220;search&#8221; disappears leaving it empty for the user to edit. If the user clicks and clicks off leaving it empty the label will return to &#8220;Search&#8221;</p>
<p><code><br />
<script type="text/javascript">
function out(){
	if(document.getElementById('test').value == ''){
	document.getElementById('test').value = 'Search...';
	}
}
</script></p>
<form>
<input name="test" id="test" value="Search..."onclick="document.getElementById('test').value='';"onblur="out();"/></form>
<p></code></p>
<p>Here is how it works.</p>
<p>A basic Javascript function to control the input box called &#8220;test&#8221;  This function basicaly says. Check if the box is empty, if it is make it&#8217;s value &#8220;Search&#8221;.<br />
The input box also calls Javascript &#8220;onclick&#8221; to clear the input and &#8220;onblur&#8221; to call the function below.</p>
<pre name="code" class="php">
<script type="text/javascript">
function out(){
	if(document.getElementById('test').value == ''){
	document.getElementById('test').value = 'Search...';
	}
}
</script>
<form>
<input name="test" id="test" value="Search..."
onclick="document.getElementById('test').value='';"
onblur="out();"
/>
</form>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.open-source-web.com/javascript/javascript-input-box-control/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

