<?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>Bright Cherry &#187; Javascript</title>
	<atom:link href="http://www.brightcherry.co.uk/scribbles/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.brightcherry.co.uk/scribbles</link>
	<description></description>
	<lastBuildDate>Fri, 27 Aug 2010 18:00:38 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>Javascript &#8211; How To Remove The Trailing Hash In A URL</title>
		<link>http://www.brightcherry.co.uk/scribbles/2010/04/25/javascript-how-to-remove-the-trailing-hash-in-a-url/</link>
		<comments>http://www.brightcherry.co.uk/scribbles/2010/04/25/javascript-how-to-remove-the-trailing-hash-in-a-url/#comments</comments>
		<pubDate>Sun, 25 Apr 2010 21:48:15 +0000</pubDate>
		<dc:creator>Maruf</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.brightcherry.co.uk/scribbles/?p=222</guid>
		<description><![CDATA[Ok, this is a quick note to myself, because I always seem to forget this code, and I have no idea why, because it&#8217;s so simple. So, the scenario is that when I&#8217;m writing AJAX code, a lot of the times I use a hyperlink to trigger an action. For example, look at the following [...]]]></description>
			<content:encoded><![CDATA[<p>Ok, this is a quick note to myself, because I always seem to forget this code, and I have no idea why, because it&#8217;s so simple.</p>
<p>So, the scenario is that when I&#8217;m writing AJAX code, a lot of the times I use a hyperlink to trigger an action. For example, look at the following code&#8230;</p>

<div class="wp_codebox_msgheader"><span class="right"><sup></sup></span><span class="left"><a rel="nofollow" href="javascript:;" onclick="javascript:showCodeTxt('p222code3'); return false;">View Code</a> JAVASCRIPT</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2223"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
</pre></td><td class="code" id="p222code3"><pre class="javascript" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;#&quot;</span> <span style="color: #003366; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;open_div&quot;</span><span style="color: #339933;">&gt;</span>Open Div<span style="color: #339933;">&lt;/</span>a<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;show_content&quot;</span> style<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;display:none&quot;</span><span style="color: #339933;">&gt;</span>Show stuff here....<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #3366CC;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</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: #3366CC;">&quot;.open_div&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</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: #3366CC;">'#show_content'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">show</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;">&#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: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>Ok, so what that code is basically doing is displaying a link, with the anchor text, <b class="pink">Open Div</b>. When the link is clicked, the <b class="pink">show_content</b> div will appear, with the containing content.</p>
<p>But the problem is, if I clicked that link on the Bright<b class="pink">Cherry</b> homepage (assuming the code was there), the URL would change to this&#8230;</p>
<p><img src="http://www.brightcherry.co.uk/images/blogimages/brightcherry_hash.jpg" title="Trailing Hash" alt="Trailing Hash" /></p>
<p>Anyone else experience this? It&#8217;s not actually a problem, but it irritates me because I find it ugly and weird (probably because I&#8217;m very particular).</p>
<h4>The Solution</h4>
<p>The fix ISN&#8217;T to simply remove the hash (#) from the A TAG, because then the code won&#8217;t work.</p>
<p>To stop the trailing hash from the URL, you just need to do the following&#8230;</p>

<div class="wp_codebox_msgheader"><span class="right"><sup></sup></span><span class="left"><a rel="nofollow" href="javascript:;" onclick="javascript:showCodeTxt('p222code4'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p2224"><td class="line_numbers"><pre>1
2
</pre></td><td class="code" id="p222code4"><pre class="html" style="font-family:monospace;">// replace the hash with the following
&lt;a href=&quot;javascript:void(0);&quot; class=&quot;open_div&quot;&gt;Open Div&lt;/a&gt;</pre></td></tr></table></div>

<p>Ahhh, that&#8217;s better.</p>
<p>Out of curiosity, has this problem actually bothered anyone else?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.brightcherry.co.uk/scribbles/2010/04/25/javascript-how-to-remove-the-trailing-hash-in-a-url/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>HTML Form Effect- Remove Default Value On Focus</title>
		<link>http://www.brightcherry.co.uk/scribbles/2008/12/04/html-form-effect-remove-default-value-on-focus/</link>
		<comments>http://www.brightcherry.co.uk/scribbles/2008/12/04/html-form-effect-remove-default-value-on-focus/#comments</comments>
		<pubDate>Thu, 04 Dec 2008 10:33:11 +0000</pubDate>
		<dc:creator>Maruf</dc:creator>
				<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.brightcherry.co.uk/scribbles/?p=108</guid>
		<description><![CDATA[This Javascript form effect basically removes the default value (e.g Your Name) when the input field is on focus. If nothing is entered, and focus is taken away from the input field, the value is displayed again. It&#8217;s a pretty cool effect, which I&#8217;m always using on a lot of projects. Here&#8217;s an example (click [...]]]></description>
			<content:encoded><![CDATA[<p>This Javascript form effect basically removes the default value (e.g Your Name) when the input field is on focus. If nothing is entered, and focus is taken away from the input field, the value is displayed again. </p>
<p>It&#8217;s a pretty cool effect, which I&#8217;m always using on a lot of projects. Here&#8217;s an example (click in the input field, and then click outside the input field):</p>
<form>
<input type="text" value="Your Name" name="name" onblur="if (this.value == '') {this.value = 'Your Name';}"  onfocus="if (this.value == 'Your Name') {this.value = '';}" />
</form>

<div class="wp_codebox_msgheader"><span class="right"><sup></sup></span><span class="left"><a rel="nofollow" href="javascript:;" onclick="javascript:showCodeTxt('p108code6'); return false;">View Code</a> HTML</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table width="100%" ><tr id="p1086"><td class="line_numbers"><pre>1
2
3
</pre></td><td class="code" id="p108code6"><pre class="html" style="font-family:monospace;">&lt;form&gt;
&lt;input type=&quot;text&quot; value=&quot;Your Name&quot; name=&quot;name&quot; onblur=&quot;if (this.value == '') {this.value = 'Your Name';}&quot;  onfocus=&quot;if (this.value == 'Your Name') {this.value = '';}&quot; /&gt;
&lt;/form&gt;</pre></td></tr></table></div>

]]></content:encoded>
			<wfw:commentRss>http://www.brightcherry.co.uk/scribbles/2008/12/04/html-form-effect-remove-default-value-on-focus/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>
