<?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>Matjaž Hladnik Blog</title>
	<atom:link href="http://blog.hladnik.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.hladnik.net</link>
	<description>Web development tips and news</description>
	<lastBuildDate>Mon, 23 Jan 2012 16:42: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>This is my last post</title>
		<link>http://blog.hladnik.net/2012/01/23/this-is-my-last-post/</link>
		<comments>http://blog.hladnik.net/2012/01/23/this-is-my-last-post/#comments</comments>
		<pubDate>Mon, 23 Jan 2012 16:42:12 +0000</pubDate>
		<dc:creator>Matjaž Hladnik</dc:creator>
				<category><![CDATA[Web development]]></category>

		<guid isPermaLink="false">http://blog.hladnik.net/?p=265</guid>
		<description><![CDATA[Well, after 2 years I&#8217;ve decided to stop writing this blog. It&#8217;ll still stay available for some undefined period of time, but eventually it&#8217;ll be deleted anyhow.]]></description>
			<content:encoded><![CDATA[<p>Well, after 2 years I&#8217;ve decided to stop writing this blog. It&#8217;ll still stay available for some undefined period of time, but eventually it&#8217;ll be deleted anyhow. </p>
]]></content:encoded>
			<wfw:commentRss>http://blog.hladnik.net/2012/01/23/this-is-my-last-post/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQLite manager (addon for Firefox)</title>
		<link>http://blog.hladnik.net/2011/09/19/sqlite-manager-addon-for-firefox/</link>
		<comments>http://blog.hladnik.net/2011/09/19/sqlite-manager-addon-for-firefox/#comments</comments>
		<pubDate>Mon, 19 Sep 2011 18:36:32 +0000</pubDate>
		<dc:creator>Matjaž Hladnik</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[addon]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[sqlite]]></category>

		<guid isPermaLink="false">http://blog.hladnik.net/?p=260</guid>
		<description><![CDATA[I&#8217;ve started programming in Python these days, because I have some new needs and some new restrictions at my new work. I&#8217;d like to continue programming with php and mysql, but I have some real difficulties accessing DB through LAN. The best solution I&#8217;ve found, is Python in combination with SQLite3. At that point I [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve started programming in Python these days, because I have some new needs and some new restrictions at my new work.</p>
<p>I&#8217;d like to continue programming with php and mysql, but I have some real difficulties accessing DB through LAN. The best solution I&#8217;ve found, is Python in combination with SQLite3.</p>
<p>At that point I have to mention SQLite Manager addon for Firefox (<a href="https://addons.mozilla.org/en-US/firefox/addon/sqlite-manager/">https://addons.mozilla.org/en-US/firefox/addon/sqlite-manager/</a>), which allows easy and quick access to sqlite3 database file.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.hladnik.net/2011/09/19/sqlite-manager-addon-for-firefox/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Accessing non-existing tags and properties by mootools</title>
		<link>http://blog.hladnik.net/2011/04/12/accessing-non-existing-tags-and-properties-by-mootools/</link>
		<comments>http://blog.hladnik.net/2011/04/12/accessing-non-existing-tags-and-properties-by-mootools/#comments</comments>
		<pubDate>Tue, 12 Apr 2011 17:09:52 +0000</pubDate>
		<dc:creator>Matjaž Hladnik</dc:creator>
				<category><![CDATA[Web development]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mootools]]></category>

		<guid isPermaLink="false">http://blog.hladnik.net/?p=247</guid>
		<description><![CDATA[Mootools can be succesfully used to access non-existing properties and tags in your HTML document. Sometimes there is not enough regular properties or attributes for some HTML tag, but you need to place your data into it. So you can made it up for yourself, like for example: &#60;option url="gmail.com" replace="google.com"&#62;&#60;/option&#62;, even if option tag [...]]]></description>
			<content:encoded><![CDATA[<p>Mootools can be succesfully used to access non-existing properties and tags in your HTML document.</p>
<p>Sometimes there is not enough regular properties or attributes for some HTML tag, but you need to place your data into it. So you can made it up for yourself, like for example:<strong> </strong></p>
<pre><strong><span style="color: #800000;">&lt;option url="gmail.com" replace="google.com"&gt;&lt;/option&gt;</span></strong>,</pre>
<p>even if option tag doesn&#8217;t suport properties url and replace. Mootools access is allways the same,<span style="color: #003300;"><strong> </strong></span></p>
<pre><span style="color: #003300;"><strong>option.getProperty('url')</strong></span>.</pre>
<p>&nbsp;</p>
<p>You can also use some non existing HTML tag, like <span style="color: #800000;"><strong> </strong></span></p>
<pre><span style="color: #800000;"><strong>&lt;nothing else="matters"/&gt;</strong></span>.</pre>
<p>The mootools has no problem with it, for example:<span style="color: #003300;"><strong> </strong></span></p>
<pre><span style="color: #003300;"><strong>alert($$('nothing')[0].getProperty('else')); </strong></span></pre>
<p>works like magic.</p>
<p>&nbsp;</p>
<p>You can also create non-existing tags, like:</p>
<pre><span style="color: #003300;"><strong>var n = new Element('nothing');</strong>
<strong>document.body.grab(n);</strong>
<strong>$$('nothing').setProperty('else','matters');</strong></span></pre>
<p>Have fun!<strong><br />
</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://blog.hladnik.net/2011/04/12/accessing-non-existing-tags-and-properties-by-mootools/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mootools class for popups</title>
		<link>http://blog.hladnik.net/2011/01/03/mootools-class-for-popups/</link>
		<comments>http://blog.hladnik.net/2011/01/03/mootools-class-for-popups/#comments</comments>
		<pubDate>Mon, 03 Jan 2011 21:34:54 +0000</pubDate>
		<dc:creator>Matjaž Hladnik</dc:creator>
				<category><![CDATA[Web development]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mootools]]></category>

		<guid isPermaLink="false">http://blog.hladnik.net/?p=235</guid>
		<description><![CDATA[I had to made a mootools class for popups, because I deal with this sort of &#8220;disturbing features&#8221; almost every day at work. I don&#8217;t know why all customers want to have popup windows on their websites. But they do. The concept is very similar to lightbox behaviour. There&#8217;s a black div that covers the [...]]]></description>
			<content:encoded><![CDATA[<p>I had to made a mootools class for popups, because I deal with this sort of &#8220;disturbing features&#8221; almost every day at work. I don&#8217;t know why all customers want to have popup windows on their websites. But they do.</p>
<p>The concept is very similar to lightbox behaviour. There&#8217;s a black div that covers the whole screen and smaller white div in the center of the screen. The white div holds inner container and close button. You can put anything into inner div, for example HTML code, JPEG image, swf file or YouTube object.</p>
<p>The divs are created in the class&#8217;s constructor. The content is filled every time by calling the open function. You need MooTools and then you can create the object like this:</p>

<div class="wp_syntax"><div class="code"><pre class="js" style="font-family:monospace;">window.addEvent('domready',function(){
	new popIt({
		bgColor: 'black',
		bgOpacity: 0.5,
		width: 640,
		height: 385,
		fgColor: '#EBF6F8',
		fgLoader: 'loading.gif',
		trigger: 'pop_up_trigger',
		closing: 'close.png',
		insert: '&lt;object width=&quot;640&quot; height=&quot;385&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/hOLAGYmUQV0?fs=1&amp;amp;hl=sl_SI&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;/param&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;/param&gt;&lt;param name=&quot;wmode&quot; value=&quot;transparent&quot;&gt;&lt;/param&gt;&lt;embed src=&quot;http://www.youtube.com/v/hOLAGYmUQV0?fs=1&amp;amp;hl=sl_SI&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; width=&quot;640&quot; height=&quot;385&quot; wmode=&quot;transparent&quot;&gt;&lt;/embed&gt;&lt;/object&gt;'
	});
})</pre></div></div>

<p>You can set the color of background div and its opacity, then you can set the color of smaller div in the middle and the loader image if you have one. You can also add a closing image, but it&#8217;s not necessary. By using the insert property you can insert into inner div any HTML you want. You can also use property inject, where you just define the ID of some HTML element, which is coppied into the inner div.</p>
<p>See the example <a href="http://www.hladnik.net/osnutki/popit/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.hladnik.net/2011/01/03/mootools-class-for-popups/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom selectbox bugfix and upgrade</title>
		<link>http://blog.hladnik.net/2010/12/17/custom-selectbox-bugfix-and-upgrade/</link>
		<comments>http://blog.hladnik.net/2010/12/17/custom-selectbox-bugfix-and-upgrade/#comments</comments>
		<pubDate>Fri, 17 Dec 2010 21:48:45 +0000</pubDate>
		<dc:creator>Matjaž Hladnik</dc:creator>
				<category><![CDATA[Web development]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mootools]]></category>

		<guid isPermaLink="false">http://blog.hladnik.net/?p=232</guid>
		<description><![CDATA[Custom selectbox has now two new things: a bugfix for keypress events and a new option zIndex for more control. Both thanks only to Andraž, you are great! See demo here.]]></description>
			<content:encoded><![CDATA[<p>Custom selectbox has now two new things:</p>
<ol>
<li>a bugfix for keypress events and</li>
<li>a new option zIndex for more control.</li>
</ol>
<p>Both thanks only to Andraž, you are great!</p>
<p>See demo <a href="http://www.hladnik.net/osnutki/selectbox/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.hladnik.net/2010/12/17/custom-selectbox-bugfix-and-upgrade/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The most simple custom checkboxes and radios</title>
		<link>http://blog.hladnik.net/2010/11/15/the-most-simple-custom-checkboxes-and-radios/</link>
		<comments>http://blog.hladnik.net/2010/11/15/the-most-simple-custom-checkboxes-and-radios/#comments</comments>
		<pubDate>Mon, 15 Nov 2010 19:23:19 +0000</pubDate>
		<dc:creator>Matjaž Hladnik</dc:creator>
				<category><![CDATA[Web development]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[mootools]]></category>

		<guid isPermaLink="false">http://blog.hladnik.net/?p=213</guid>
		<description><![CDATA[Custom designed checkboxes and radio buttons are very common subject on the web, but that didn&#8217;t stop me from writing this post about my approach to that problem. I like to keep things simple and that is certainly one of them. Javascript uses MooTools to apply some classes and events to labels around inputs. If [...]]]></description>
			<content:encoded><![CDATA[<p>Custom designed checkboxes and radio buttons are very common subject on the web, but that didn&#8217;t stop me from writing this post about my approach to that problem. I like to keep things simple and that is certainly one of them. </p>
<p>Javascript uses MooTools to apply some classes and events to labels around inputs. If javascript is disabled nothing happens; all checkboxes and radios remain unstyled.</p>
<p>You need to put <em>label </em>tags around you <em>input </em>tags. That&#8217;s because of:<br />
1.) easy CSS styling<br />
2.) clickability (label click automatically affects the input child)</p>
<p>CSS:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">label<span style="color: #339933;">.</span>check <span style="color: #009900;">&#123;</span>
	background<span style="color: #339933;">:</span> url<span style="color: #009900;">&#40;</span>check_off<span style="color: #339933;">.</span>gif<span style="color: #009900;">&#41;</span> no<span style="color: #339933;">-</span>repeat left center<span style="color: #339933;">;</span>
	padding<span style="color: #339933;">-</span>left<span style="color: #339933;">:</span> 15px<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
label<span style="color: #339933;">.</span>check<span style="color: #339933;">.</span>on <span style="color: #009900;">&#123;</span>
	background<span style="color: #339933;">:</span> url<span style="color: #009900;">&#40;</span>check_on<span style="color: #339933;">.</span>gif<span style="color: #009900;">&#41;</span> no<span style="color: #339933;">-</span>repeat left center<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
label<span style="color: #339933;">.</span>radio <span style="color: #009900;">&#123;</span>
	background<span style="color: #339933;">:</span> url<span style="color: #009900;">&#40;</span>radio_off<span style="color: #339933;">.</span>gif<span style="color: #009900;">&#41;</span> no<span style="color: #339933;">-</span>repeat left center<span style="color: #339933;">;</span>
	padding<span style="color: #339933;">-</span>left<span style="color: #339933;">:</span> 15px<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
label<span style="color: #339933;">.</span>radio<span style="color: #339933;">.</span>on <span style="color: #009900;">&#123;</span>
	background<span style="color: #339933;">:</span> url<span style="color: #009900;">&#40;</span>radio_on<span style="color: #339933;">.</span>gif<span style="color: #009900;">&#41;</span> no<span style="color: #339933;">-</span>repeat left center<span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>You just have to style those labels a little bit to behave as custom checkbox or radio buttons.</p>
<p>XHTML:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>form method<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;get&quot;</span> action<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;#&quot;</span><span style="color: #339933;">&gt;</span>
	<span style="color: #339933;">&lt;</span>fieldset<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>label<span style="color: #339933;">&gt;&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;checkbox&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;1&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;check[]&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;custom&quot;</span><span style="color: #339933;">/&gt;</span> Checkbox <span style="color: #cc66cc;">1</span><span style="color: #339933;">&lt;/</span>label<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>label<span style="color: #339933;">&gt;&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;checkbox&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;2&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;check[]&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;custom&quot;</span><span style="color: #339933;">/&gt;</span> Checkbox <span style="color: #cc66cc;">2</span><span style="color: #339933;">&lt;/</span>label<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>label<span style="color: #339933;">&gt;&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;checkbox&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;3&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;check[]&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;custom&quot;</span><span style="color: #339933;">/&gt;</span> Checkbox <span style="color: #cc66cc;">3</span><span style="color: #339933;">&lt;/</span>label<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>br<span style="color: #339933;">/&gt;&lt;</span>br<span style="color: #339933;">/&gt;</span>
		<span style="color: #339933;">&lt;</span>label<span style="color: #339933;">&gt;&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;checkbox&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;1&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;test[]&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;custom&quot;</span><span style="color: #339933;">/&gt;</span> Test <span style="color: #cc66cc;">1</span><span style="color: #339933;">&lt;/</span>label<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>label<span style="color: #339933;">&gt;&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;checkbox&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;2&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;test[]&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;custom&quot;</span><span style="color: #339933;">/&gt;</span> Test <span style="color: #cc66cc;">2</span><span style="color: #339933;">&lt;/</span>label<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>label<span style="color: #339933;">&gt;&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;checkbox&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;3&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;test[]&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;custom&quot;</span><span style="color: #339933;">/&gt;</span> Test <span style="color: #cc66cc;">3</span><span style="color: #339933;">&lt;/</span>label<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>br<span style="color: #339933;">/&gt;&lt;</span>br<span style="color: #339933;">/&gt;</span>
		<span style="color: #339933;">&lt;</span>label<span style="color: #339933;">&gt;&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;radio&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;radio&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;1&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;custom&quot;</span><span style="color: #339933;">/&gt;</span> Radio <span style="color: #cc66cc;">1</span><span style="color: #339933;">&lt;/</span>label<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>label<span style="color: #339933;">&gt;&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;radio&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;radio&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;2&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;custom&quot;</span><span style="color: #339933;">/&gt;</span> Radio <span style="color: #cc66cc;">2</span><span style="color: #339933;">&lt;/</span>label<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>label<span style="color: #339933;">&gt;&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;radio&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;radio&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;3&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;custom&quot;</span><span style="color: #339933;">/&gt;</span> Radio <span style="color: #cc66cc;">3</span><span style="color: #339933;">&lt;/</span>label<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>br<span style="color: #339933;">/&gt;&lt;</span>br<span style="color: #339933;">/&gt;</span>
		<span style="color: #339933;">&lt;</span>label<span style="color: #339933;">&gt;&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;radio&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;tv&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;1&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;custom&quot;</span><span style="color: #339933;">/&gt;</span> TV <span style="color: #cc66cc;">1</span><span style="color: #339933;">&lt;/</span>label<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>label<span style="color: #339933;">&gt;&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;radio&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;tv&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;2&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;custom&quot;</span><span style="color: #339933;">/&gt;</span> TV <span style="color: #cc66cc;">2</span><span style="color: #339933;">&lt;/</span>label<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>label<span style="color: #339933;">&gt;&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;radio&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;tv&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;3&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;custom&quot;</span><span style="color: #339933;">/&gt;</span> TV <span style="color: #cc66cc;">3</span><span style="color: #339933;">&lt;/</span>label<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>br<span style="color: #339933;">/&gt;&lt;</span>br<span style="color: #339933;">/&gt;</span>
		<span style="color: #339933;">&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;submit&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Send&quot;</span><span style="color: #339933;">/&gt;</span>
	<span style="color: #339933;">&lt;/</span>fieldset<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>form<span style="color: #339933;">&gt;</span></pre></div></div>

<p>It is absolutely necessary to put <em>labels </em>around <em>inputs</em>. The <em>label</em> becomes active only if the <em>input </em>has class=&#8221;custom&#8221;.</p>
<p>Javascript (be sure to have MooTools):</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;"><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><span style="color: #3366CC;">'input[type=checkbox].custom'</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>el<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		el.<span style="color: #660066;">getParent</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'label'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'check'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addEvent</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'click'</span><span style="color: #339933;">,</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>el.<span style="color: #660066;">checked</span><span style="color: #009900;">&#41;</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'on'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">removeClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'on'</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> 
		el.<span style="color: #660066;">setStyle</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'display'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'none'</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;">&#40;</span><span style="color: #3366CC;">'input[type=radio].custom'</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>el<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		el.<span style="color: #660066;">getParent</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'label'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'radio'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addEvent</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'click'</span><span style="color: #339933;">,</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[name='</span><span style="color: #339933;">+</span>el.<span style="color: #000066;">name</span><span style="color: #339933;">+</span><span style="color: #3366CC;">']'</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>rad<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
				rad.<span style="color: #660066;">getParent</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'label'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">removeClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'on'</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: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">addClass</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'on'</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> 
		el.<span style="color: #660066;">setStyle</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'display'</span><span style="color: #339933;">,</span><span style="color: #3366CC;">'none'</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></div></div>

<p>And this is everything. Of course you should style your <em>labels </em>much more as I did. My effort for this example was as easy as it could be. Demo <a href="http://www.hladnik.net/osnutki/checkbox">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.hladnik.net/2010/11/15/the-most-simple-custom-checkboxes-and-radios/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Simple mysql toggle (tinyint value)</title>
		<link>http://blog.hladnik.net/2010/10/16/simple-mysql-toggle-tinyint-value/</link>
		<comments>http://blog.hladnik.net/2010/10/16/simple-mysql-toggle-tinyint-value/#comments</comments>
		<pubDate>Sat, 16 Oct 2010 15:10:05 +0000</pubDate>
		<dc:creator>Matjaž Hladnik</dc:creator>
				<category><![CDATA[Web development]]></category>
		<category><![CDATA[mysql]]></category>

		<guid isPermaLink="false">http://blog.hladnik.net/?p=208</guid>
		<description><![CDATA[A very simple way to toggle a tinyint field in your mysql table. The mysql table example: CREATE TABLE `products` &#40; `id` int&#40;10&#41; NOT NULL auto_increment, `name` varchar&#40;50&#41; NOT NULL, `visible` tinyint&#40;1&#41; NOT NULL, PRIMARY KEY &#40;`id`&#41; &#41; ENGINE=MyISAM DEFAULT CHARSET=utf8; $sql = mysql_query&#40;&#34; UPDATE products SET visible = visible &#60;&#62; 1 WHERE id = [...]]]></description>
			<content:encoded><![CDATA[<p>A very simple way to toggle a tinyint field in your mysql table.</p>
<p>The mysql table example:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">CREATE TABLE `products` <span style="color: #009900;">&#40;</span>
  `id` int<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span> NOT <span style="color: #009900; font-weight: bold;">NULL</span> auto_increment<span style="color: #339933;">,</span>
  `name` varchar<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">50</span><span style="color: #009900;">&#41;</span> NOT <span style="color: #009900; font-weight: bold;">NULL</span><span style="color: #339933;">,</span>
  `visible` tinyint<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> NOT <span style="color: #009900; font-weight: bold;">NULL</span><span style="color: #339933;">,</span>
  PRIMARY <span style="color: #990000;">KEY</span>  <span style="color: #009900;">&#40;</span>`id`<span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span> ENGINE<span style="color: #339933;">=</span>MyISAM <span style="color: #b1b100;">DEFAULT</span> CHARSET<span style="color: #339933;">=</span>utf8<span style="color: #339933;">;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$sql</span> <span style="color: #339933;">=</span> <span style="color: #990000;">mysql_query</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot; UPDATE products SET visible = visible &lt;&gt; 1 WHERE id = '<span style="color: #006699; font-weight: bold;">$id</span>' &quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>If you want to toggle the <em>visible</em> field of a specific product, just execute this query. If the field <em>visible </em>has value 0, it will be updated to 1. If it is already 1, it will be updated to 0.</p>
<p>Extra tip: I put the <strong>$id</strong> variable inside the &#8216;&#8230;&#8217; quotes to avoid broken query, if the <strong>$id</strong> is empty or not an integer.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.hladnik.net/2010/10/16/simple-mysql-toggle-tinyint-value/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Custom select box upgrade</title>
		<link>http://blog.hladnik.net/2010/09/30/custom-select-box-upgrade/</link>
		<comments>http://blog.hladnik.net/2010/09/30/custom-select-box-upgrade/#comments</comments>
		<pubDate>Thu, 30 Sep 2010 15:24:25 +0000</pubDate>
		<dc:creator>Matjaž Hladnik</dc:creator>
				<category><![CDATA[Web development]]></category>
		<category><![CDATA[classes]]></category>
		<category><![CDATA[dropdown]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[selectbox]]></category>

		<guid isPermaLink="false">http://blog.hladnik.net/?p=196</guid>
		<description><![CDATA[I&#8217;ve made a little improvement on my custom select box mootools class. Custom selectbox now: applies the selected element as active and fires the change event of it&#8217;s select tag. Use the selected property on the option tag: &#60;option value=&#34;40&#34; selected=&#34;selected&#34;&#62;fourty&#60;/option&#62; Define onchange event through property: &#60;select onchange=&#34;alert('Ninja!');&#34;&#62; Or add event change through mootools: $&#40;'sel2'&#41;.addEvent&#40;'change', [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve made a little improvement on my <a href="http://blog.hladnik.net/2010/02/16/custom-selectbox/">custom select box mootools class</a>. </p>
<p>Custom selectbox now:</p>
<ol>
<li>applies the <em>selected</em> element as active and </li>
<li>fires the <em>change</em> event of it&#8217;s select tag.</li>
</ol>
<p>Use the <em>selected</em> property on the <em>option</em> tag:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>option value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;40&quot;</span> selected<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;selected&quot;</span><span style="color: #339933;">&gt;</span>fourty<span style="color: #339933;">&lt;/</span>option<span style="color: #339933;">&gt;</span></pre></div></div>

<p>Define <em>onchange</em> event through property:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>select onchange<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;alert('Ninja!');&quot;</span><span style="color: #339933;">&gt;</span></pre></div></div>

<p>Or add event <em>change</em> through mootools:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'sel2'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">addEvent</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'change'</span><span style="color: #339933;">,</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: #000066; font-weight: bold;">this</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">==</span> <span style="color: #CC0000;">70</span><span style="color: #009900;">&#41;</span> <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'You hit 70!'</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></div></div>

<p>See demo <a href="http://www.hladnik.net/osnutki/selectbox/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.hladnik.net/2010/09/30/custom-select-box-upgrade/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mootools method definition outside of a class (with example)</title>
		<link>http://blog.hladnik.net/2010/09/26/mootools-method-definition-outside-of-a-class-with-example/</link>
		<comments>http://blog.hladnik.net/2010/09/26/mootools-method-definition-outside-of-a-class-with-example/#comments</comments>
		<pubDate>Sun, 26 Sep 2010 07:02:22 +0000</pubDate>
		<dc:creator>Matjaž Hladnik</dc:creator>
				<category><![CDATA[Web development]]></category>
		<category><![CDATA[classes]]></category>
		<category><![CDATA[functions]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mootools]]></category>
		<category><![CDATA[web development]]></category>

		<guid isPermaLink="false">http://blog.hladnik.net/?p=164</guid>
		<description><![CDATA[I&#8217;ve been exploring these days how to create a definition of some method outside of it&#8217;s class. Usually there is no need to do that, but I had to write a class which works as a calculator with different input fields. Each input field has it&#8217;s own custom formula and I really wanted to avoid [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been exploring these days how to create a definition of some method outside of it&#8217;s class. Usually there is no need to do that, but I had to write a class which works as a calculator with different input fields. Each input field has it&#8217;s own custom formula and I really wanted to avoid the <strong>eval()</strong> function.</p>
<p>The idea is simple: to create a class with some extra empty function (method), which can be defined from the outside, more specificly through it&#8217;s object in it&#8217;s custom way.</p>
<pre><span style="color: navy; font-size: 11px;">class Test {
    initialize: function(){
        ...
        <strong style="color: red;">this.my_extra();</strong>
    },
    function_1: function(){...},
    function_2: function(){...},
   <strong style="color: red;"> my_extra: function(){ return 0; }</strong>
}

var A1 = new Test();
<strong style="color: red;">A1.my_extra = function(a){
    return a * a;
}</strong></span></pre>
<p>I tested this functionality in many different ways and I must say it works fine in almost any way you want. Outside methods can use arguments, call other class&#8217;s methods, call $(el) objects, and so on&#8230; You don&#8217;t even have to define an empty method inside the class, but it is convenient because you don&#8217;t know if it will be defined by object or not.</p>
<h3>The numberConverter class</h3>
<p>And here is my calculator with three input fields: tax, price, full price. By changing any of those fields the other two fields must re-calculate. Each field has it&#8217;s own calculation formula, it&#8217;s own event and affects a different field.</p>
<p>HTML:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;page&quot;</span><span style="color: #339933;">&gt;</span>
        <span style="color: #339933;">&lt;</span>select id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;tax&quot;</span><span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>option value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;0&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">&lt;/</span>option<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>option value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;20&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #cc66cc;">20</span><span style="color: #339933;">&lt;/</span>option<span style="color: #339933;">&gt;</span>
	<span style="color: #339933;">&lt;/</span>select<span style="color: #339933;">&gt;</span>
	<span style="color: #339933;">&lt;</span>input id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;price&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text&quot;</span> <span style="color: #339933;">/&gt;</span>
	<span style="color: #339933;">&lt;</span>input id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;full_price&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text&quot;</span> <span style="color: #339933;">/&gt;</span>
<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span></pre></div></div>

<p>JS:</p>

<div class="wp_syntax"><div class="code"><pre class="css" style="font-family:monospace;">var p <span style="color: #00AA00;">=</span> new numberConverter<span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'price'</span><span style="color: #00AA00;">,</span><span style="color: #00AA00;">&#123;</span>
	onEvent<span style="color: #00AA00;">:</span> <span style="color: #ff0000;">'keyup'</span><span style="color: #00AA00;">,</span>
	affects<span style="color: #00AA00;">:</span> <span style="color: #ff0000;">'full_price'</span>
<span style="color: #00AA00;">&#125;</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
p<span style="color: #6666ff;">.formula</span> <span style="color: #00AA00;">=</span> function<span style="color: #00AA00;">&#40;</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#123;</span>
	return p.val<span style="color: #00AA00;">&#40;</span><span style="color: #00AA00;">&#41;</span> <span style="color: #00AA00;">*</span> <span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">1</span> <span style="color: #00AA00;">+</span> p.val<span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'tax'</span><span style="color: #00AA00;">&#41;</span> / <span style="color: #cc66cc;">100</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
var t <span style="color: #00AA00;">=</span> new numberConverter<span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'tax'</span><span style="color: #00AA00;">,</span><span style="color: #00AA00;">&#123;</span>
	onEvent<span style="color: #00AA00;">:</span> <span style="color: #ff0000;">'change'</span><span style="color: #00AA00;">,</span>
	affects<span style="color: #00AA00;">:</span> <span style="color: #ff0000;">'full_price'</span>
<span style="color: #00AA00;">&#125;</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
t<span style="color: #6666ff;">.formula</span> <span style="color: #00AA00;">=</span> function<span style="color: #00AA00;">&#40;</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#123;</span>
	return t.val<span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'price'</span><span style="color: #00AA00;">&#41;</span> <span style="color: #00AA00;">*</span> <span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">1</span> <span style="color: #00AA00;">+</span> t.val<span style="color: #00AA00;">&#40;</span><span style="color: #00AA00;">&#41;</span> / <span style="color: #cc66cc;">100</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
var f <span style="color: #00AA00;">=</span> new numberConverter<span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'full_price'</span><span style="color: #00AA00;">,</span><span style="color: #00AA00;">&#123;</span>
	onEvent<span style="color: #00AA00;">:</span> <span style="color: #ff0000;">'keyup'</span><span style="color: #00AA00;">,</span>
	affects<span style="color: #00AA00;">:</span> <span style="color: #ff0000;">'price'</span>
<span style="color: #00AA00;">&#125;</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
f<span style="color: #6666ff;">.formula</span> <span style="color: #00AA00;">=</span> function<span style="color: #00AA00;">&#40;</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">&#123;</span>
	return f.val<span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'full_price'</span><span style="color: #00AA00;">&#41;</span> / <span style="color: #00AA00;">&#40;</span><span style="color: #cc66cc;">1</span> <span style="color: #00AA00;">+</span> f.val<span style="color: #00AA00;">&#40;</span><span style="color: #ff0000;">'tax'</span><span style="color: #00AA00;">&#41;</span> / <span style="color: #cc66cc;">100</span><span style="color: #00AA00;">&#41;</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div>

<p>You can see that every new object defines it&#8217;s own calculation formula, which uses the <strong>val</strong> method from class to adjust decimal points and decimal places.</p>
<p>The <strong>numberConverter</strong> demo is <a href="http://www.hladnik.net/osnutki/numberConverter/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.hladnik.net/2010/09/26/mootools-method-definition-outside-of-a-class-with-example/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rating and voting with stars</title>
		<link>http://blog.hladnik.net/2010/09/21/rating-and-voting-with-stars/</link>
		<comments>http://blog.hladnik.net/2010/09/21/rating-and-voting-with-stars/#comments</comments>
		<pubDate>Tue, 21 Sep 2010 18:59:57 +0000</pubDate>
		<dc:creator>Matjaž Hladnik</dc:creator>
				<category><![CDATA[Web development]]></category>
		<category><![CDATA[classes]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[mootools]]></category>

		<guid isPermaLink="false">http://blog.hladnik.net/?p=151</guid>
		<description><![CDATA[I&#8217;ve created a mootools class for stars rating and voting. All you have to do: include mootools include starsrating.js create an empty div to place stars create two images star_on and star_off class creates everything else (shows rating, enables voting, voting process is ajax based) php processing is up to you (my demo doesn&#8217;t work [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve created a mootools class for stars rating and voting. All you have to do:</p>
<ol>
<li>include mootools</li>
<li>include starsrating.js</li>
<li>create an empty div to place stars</li>
<li>create two images star_on and star_off</li>
<li>class creates everything else (shows rating, enables voting, voting process is ajax based)</li>
<li>php processing is up to you (my demo doesn&#8217;t work for real)</li>
</ol>
<p>HTML:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;rating&quot;</span><span style="color: #339933;">&gt;&lt;/</span>div<span style="color: #339933;">&gt;</span></pre></div></div>

<p>JS:</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">window.<span style="color: #660066;">addEvent</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'domready'</span><span style="color: #339933;">,</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: #003366; font-weight: bold;">new</span> starsRating<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'rating'</span><span style="color: #339933;">,</span><span style="color: #009900;">&#123;</span>
    starOn<span style="color: #339933;">:</span> <span style="color: #3366CC;">'star_on.jpg'</span><span style="color: #339933;">,</span>
    starOff<span style="color: #339933;">:</span> <span style="color: #3366CC;">'star_off.jpg'</span><span style="color: #339933;">,</span>
    starWidth<span style="color: #339933;">:</span> <span style="color: #CC0000;">16</span><span style="color: #339933;">,</span>
    starHeight<span style="color: #339933;">:</span> <span style="color: #CC0000;">16</span><span style="color: #339933;">,</span>
    starCount<span style="color: #339933;">:</span> <span style="color: #CC0000;">5</span><span style="color: #339933;">,</span>
    rating<span style="color: #339933;">:</span> <span style="color: #CC0000;">2.33</span><span style="color: #339933;">,</span>
    voteUrl<span style="color: #339933;">:</span> <span style="color: #3366CC;">'vote.php'</span><span style="color: #339933;">,</span>
    canVote<span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">true</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></div></div>

<p>Check out the demo <a title="Stars" href="http://www.hladnik.net/osnutki/stars/">here</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.hladnik.net/2010/09/21/rating-and-voting-with-stars/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

