<?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>Kerkness.ca &#187; javascript</title>
	<atom:link href="http://www.kerkness.ca/tagged/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.kerkness.ca</link>
	<description>flexing my kerkness, among other things</description>
	<lastBuildDate>Wed, 14 Oct 2009 15:12:39 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.3</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Dynamically add row to a table using PHP and Mootools</title>
		<link>http://www.kerkness.ca/add-row-to-table/</link>
		<comments>http://www.kerkness.ca/add-row-to-table/#comments</comments>
		<pubDate>Mon, 25 May 2009 19:44:54 +0000</pubDate>
		<dc:creator>Kerk</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[injection]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[table]]></category>

		<guid isPermaLink="false">http://www.kerkness.ca/?p=529</guid>
		<description><![CDATA[This short cross browser example will show you how to dynamically add rows to a table using PHP and Mootools.
The Files

table_form.html  ::  This is our main HTML file.  It contains a HTML Table and a simple Form.
table_form.php :: This is the php file which will process the form and return results back to our HTML [...]]]></description>
			<content:encoded><![CDATA[<p>This short cross browser example will show you how to dynamically add rows to a table using PHP and Mootools.</p>
<h2>The Files</h2>
<ul>
<li>table_form.html  ::  This is our main HTML file.  It contains a HTML Table and a simple Form.</li>
<li>table_form.php :: This is the php file which will process the form and return results back to our HTML page</li>
<li><a href="http://kerkness.ca/moo/table_form/table_form.js">table_form.js</a> :: This is the Javascript file which will handle submitting data to php and handle the response</li>
<li>table_form.css :: basic css file to add styling</li>
</ul>
<p><a href="http://kerkness.ca/moo/table_form/table_form.html">View a Demo</a></p>
<p><a href="http://kerkness.ca/moo/table_form/table_form.zip">Download the full Source</a></p>
<p>I&#8217;ve tried to add detailed comments to the source code but if you have any questions just post them in the comments.</p>
<h2>The Bare Bones : Row Injection</h2>
<p>For those who are only interested in the table row injection here is a function which will get the job done and is crossbrowser. If you find otherwise let me know. The key here is instead of creating individual elements for tr and td and injecting them into the table, you create a full table element with a single row and inject that into your table.</p>
<pre name="code" class"js">
var inject_row = function( table, data )
{
    var str = '';
    data.each(function(item, index){
        str += '&lt;td&gt;'+item+'&lt;/td&gt;';
    });
    var tr = new Element('div', {
        html: '&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;' + str + '&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;'
    }).getElement('tr');
    tr.inject( table );
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.kerkness.ca/add-row-to-table/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Hot Flash Alert :: An Alert Box using Mootools</title>
		<link>http://www.kerkness.ca/mootools-alert-box/</link>
		<comments>http://www.kerkness.ca/mootools-alert-box/#comments</comments>
		<pubDate>Sat, 23 May 2009 17:29:16 +0000</pubDate>
		<dc:creator>Kerk</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Components]]></category>
		<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[alert]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mootools]]></category>

		<guid isPermaLink="false">http://www.kerkness.ca/?p=507</guid>
		<description><![CDATA[I&#8217;ve been playing around with mootools and have created a little alert box called &#8220;Hot Flash Alert&#8221; which can be handy for flashing confirmation messages to a user or informing them of input errors.
Example
Show Alert then Fade
Show Alert
To use Hot Flash Alert in your web site you&#8217;ll need to complete a few simple steps.
Step 1 [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been playing around with mootools and have created a little alert box called &#8220;Hot Flash Alert&#8221; which can be handy for flashing confirmation messages to a user or informing them of input errors.</p>
<h2>Example</h2>
<p><a id="hot_flash_fade_out_button" href="#">Show Alert then Fade</a></p>
<p><a id="hot_flash_button" href="#">Show Alert</a></p>
<p>To use Hot Flash Alert in your web site you&#8217;ll need to complete a few simple steps.</p>
<h2>Step 1 : Include the required Javascript and CSS files in your web site header.</h2>
<p>The Hot Flash Alert requires <a href="http://ajax.googleapis.com/ajax/libs/mootools/1.2.1/mootools-yui-compressed.js">Mootools.js</a>, <a href="http://kerkness.ca/hot_flash/hot_flash.js">hot_flash.js</a>, and <a href="http://kerkness.ca/hot_flash/hot_flash.css">hot_flash.css</a> .</p>
<h2>Step 2 : Add the Alert Box DIV to your theme</h2>
<p>The Hot Flash Alert is actually a div which sits in your web page until it is called.  It&#8217;s probably best to stick the div at the bottom of your web page so that it displays on top of any other absolutely positioned elements.</p>
<pre>
&lt;div id="alert_box"&gt;
   &lt;div id="alert_head"&gt;
      &lt;a id="alert_box_x" href="#"&gt;close&lt;/a&gt;
   &lt;/div&gt;
   &lt;div id="alert_box_message"&gt;&lt;/div&gt;
&lt;/div&gt;</pre>
<p>You can customize the DIV anyway you want but it will require all four elements &#8216;alert_box&#8217;, &#8216;alert_head&#8217;, &#8216;alert_box_x&#8217; and &#8216;alert_box_message&#8217;.  The styling of these elements is handled by the <a href="http://kerkness.ca/hot_flash/hot_flash.css">hot_flash.css</a> file.</p>
<h2>Step 3 :  Call the hot_flash() javascript method</h2>
<p>Once all the pieces are in place you can pop open the Hot Flash Alert by calling the hot_flash() javacript method. </p>
<pre>
 // text = the message that will be displayed
 // duration (optional) milliseconds to fade out the alert
 hot_flash( text, duration );
</pre>
<p>Here are some examples.</p>
<pre>
  // simple alert that fades out on it's own
  // over 2000 milliseconds ( or 2 seconds )
  hot_flash('hello world', 2000 );

  // simple alert with close button
  hot_flash('goodbye world');</pre>
<p>It&#8217;s as simple as that.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.kerkness.ca/mootools-alert-box/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ajax shhmajax : Just show me a simple XMLHttpRequest Example</title>
		<link>http://www.kerkness.ca/ajax-shhmajax-just-show-me-a-simple-xmlhttprequest-example/</link>
		<comments>http://www.kerkness.ca/ajax-shhmajax-just-show-me-a-simple-xmlhttprequest-example/#comments</comments>
		<pubDate>Wed, 08 Apr 2009 17:05:22 +0000</pubDate>
		<dc:creator>Kerk</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Musings]]></category>
		<category><![CDATA[ajax]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[XMLHttpRequest]]></category>

		<guid isPermaLink="false">http://www.kerkness.ca/?p=414</guid>
		<description><![CDATA[There is no shortage of bloated and complicated &#8216; ajax &#8216; libraries out there. I say ajax with quotes because I find the term to be somewhat useless other than to add further confusion to something that should just be called what it is.. an XMLHttpRequest. When the term &#8216; ajax &#8216; first started being [...]]]></description>
			<content:encoded><![CDATA[<p>There is no shortage of bloated and complicated &#8216; ajax &#8216; libraries out there. I say ajax with quotes because I find the term to be somewhat useless other than to add further confusion to something that should just be called what it is.. an XMLHttpRequest. When the term &#8216; ajax &#8216; first started being used I was like all &#8220;oooh, what&#8217;s this ? &#8221; but then I was like &#8221; oh, it&#8217;s just XMLHttpRequest.  I&#8217;ve been using that for a few years &#8220;.</p>
<p>Anyway here are a couple of very simple and straightforward ajax functions ( yes I&#8217;m calling them ajax even tho I hate the word ).</p>
<p><code><br />
function ajaxPost(url,stream,callback)<br />
{<br />
	ajaxRequest(url,stream,callback,'POST');<br />
}</p>
<p>function ajaxGet(url,callback)<br />
{<br />
	ajaxRequest(url, '' ,callback, 'GET' );<br />
}</p>
<p>function ajaxRequest(url,stream,callback,method)<br />
{<br />
	if( ! method ) method = 'POST';<br />
    var xmlhttp = new XMLHttpRequest();<br />
    xmlhttp.open(method, url, true);<br />
    xmlhttp.setRequestHeader('Content-Type','application/x-www-form-urlencoded');<br />
    xmlhttp.onreadystatechange=function() {<br />
        if(xmlhttp.readyState==4)<br />
            { callback(xmlhttp.responseText); }<br />
    };<br />
    xmlhttp.send(stream);<br />
}<br />
</code></p>
<p>Here&#8217;s an example of how to use these functions.</p>
<p><code><br />
&lt;script&gt;<br />
function callRequest()<br />
{<br />
     var uri = "http://kerkness.ca/kerkdemo/hello.world";<br />
     var stream = "myvar=this&#038;myothervar=that";<br />
     ajaxGet( uri, requestResponseHandler );<br />
}<br />
function requestResponseHandler( response )<br />
{<br />
    alert( response );<br />
}<br />
&lt;/script&gt;</p>
<p>&lt;a href="#" onclick="callRequest()"&gt;clicky me&lt;/a&gt;</p>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://www.kerkness.ca/ajax-shhmajax-just-show-me-a-simple-xmlhttprequest-example/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Javascript Redirect from Blogspot to WordPress Site</title>
		<link>http://www.kerkness.ca/javascript-redirect-from-blogspot-to-wordpress-site/</link>
		<comments>http://www.kerkness.ca/javascript-redirect-from-blogspot-to-wordpress-site/#comments</comments>
		<pubDate>Wed, 17 Dec 2008 07:07:10 +0000</pubDate>
		<dc:creator>Kerk</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[blogger]]></category>
		<category><![CDATA[blogspot]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.kerkness.ca/?p=317</guid>
		<description><![CDATA[Ok. So you&#8217;ve had a blogspot blog for a little while and you&#8217;ve decided you want a WordPress site. How do you redirect traffic from the old site to the new site and lose as little traffic as possible in the process.
First.  Use the import feature available in WordPress.  From your Daskboard, look for Tools [...]]]></description>
			<content:encoded><![CDATA[<p>Ok. So you&#8217;ve had a blogspot blog for a little while and you&#8217;ve decided you want a WordPress site. How do you redirect traffic from the old site to the new site and lose as little traffic as possible in the process.</p>
<p>First.  Use the import feature available in WordPress.  From your Daskboard, look for Tools &gt; Import</p>
<p>Second.  Add some javascript code to your blogger template.  Update the vars  blogTitle and wordPressUrl to match your blogspot blog.</p>
<p><code><br />
&lt;script&gt;<br />
var blogTitle = 'Flexing My Kerkness';<br />
var wordPressUrl = 'http://kerkness.ca';</code></p>
<p>if( document.title == blogTitle ){<br />
window.location = wordPressUrl;<br />
} else {<br />
var newUrl = str_replace( document.title, blogTitle+&#8217;: &#8216;, &#8221; );<br />
window.location = wordPressUrl + &#8216;/?s=&#8217; + newUrl;<br />
}<br />
function str_replace(haystack, needle, replacement) {<br />
var temp = haystack.split(needle);<br />
return temp.join(replacement);<br />
}<br />
&lt;/script&gt;</p>
<p>Basically what this script does is redirects from your blogger site to your new domain while conducting a search based on the title of page being requested.</p>
<p>For example.  If you had a post called &#8220;How to change outboard motor oil&#8221; on blogger.  When you try and access the blogspot url for that post you will be directed to the new wordpress domain and you will search for posts matching &#8220;How to change outboard motor oil&#8221;.  If that post was imported into word press and you haven&#8217;t changed the title.  Users will be shown a link to the post on your new site. Also they may find any new or relevant content you&#8217;ve posted since making the change to WordPress.</p>
<p>If you want to try it out just try searching for links to my old blogspot blog.. <a href="http://www.google.com/search?q=site:http://kerkness.blogspot.com"> http://kerkness.blogspot.com</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.kerkness.ca/javascript-redirect-from-blogspot-to-wordpress-site/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>
