<?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>Ruben Sargsyan &#187; JavaScript</title>
	<atom:link href="http://rubensargsyan.com/category/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://rubensargsyan.com</link>
	<description>Personal Website</description>
	<lastBuildDate>Thu, 01 Dec 2011 19:15:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Change input type from text to password for IE</title>
		<link>http://rubensargsyan.com/change-input-type-from-text-to-password-for-ie/</link>
		<comments>http://rubensargsyan.com/change-input-type-from-text-to-password-for-ie/#comments</comments>
		<pubDate>Thu, 28 Apr 2011 18:08:22 +0000</pubDate>
		<dc:creator>Ruben Sargsyan</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[ie]]></category>

		<guid isPermaLink="false">http://rubensargsyan.com/?p=615</guid>
		<description><![CDATA[Changing the type of input after page loaded is not supported in IE and here is an example how to do it using the other way: &#60;html&#62; &#160; &#60;head&#62; &#60;title&#62;Change input type from text to password for IE&#60;/title&#62; &#60;/head&#62; &#160; &#60;body&#62; &#160; &#60;div id=&#34;password_field&#34;&#62; &#60;input type=&#34;text&#34; id=&#34;password&#34; name=&#34;password&#34; value=&#34;Password&#34; onclick=&#34;change_pass_field_type_topass()&#34; /&#62; &#60;/div&#62; &#160; &#60;script type=&#34;text/javascript&#34;&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>Changing the type of input after page loaded is not supported in IE and here is an example how to do it using the other way:<span id="more-615"></span></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">&lt;html&gt;
&nbsp;
&lt;head&gt;
  &lt;title&gt;Change input type from text to password for IE&lt;/title&gt;
&lt;/head&gt;
&nbsp;
&lt;body&gt;
&nbsp;
    &lt;div id=&quot;password_field&quot;&gt;
        &lt;input type=&quot;text&quot; id=&quot;password&quot; name=&quot;password&quot; value=&quot;Password&quot; onclick=&quot;change_pass_field_type_topass()&quot; /&gt;
    &lt;/div&gt;
&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: #003366; font-weight: bold;">function</span> change_pass_field_type_topass<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>document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;password&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">value</span><span style="color: #339933;">==</span><span style="color: #3366CC;">&quot;Password&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #003366; font-weight: bold;">var</span> pass_new_field <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;input&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            pass_new_field.<span style="color: #000066;">name</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;password&quot;</span><span style="color: #339933;">;</span>
            pass_new_field.<span style="color: #660066;">id</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;password&quot;</span><span style="color: #339933;">;</span>
&nbsp;
            pass_new_field.<span style="color: #660066;">type</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;password&quot;</span><span style="color: #339933;">;</span>
            pass_new_field.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
            pass_new_field.<span style="color: #000066;">onblur</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>
                change_pass_field_type_totext<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
&nbsp;
            document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;password_field&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">removeChild</span><span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;password&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;password_field&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>pass_new_field<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;password&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #000066;">focus</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;">&#125;</span>
&nbsp;
    <span style="color: #003366; font-weight: bold;">function</span> change_pass_field_type_totext<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>document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;password&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">value</span><span style="color: #339933;">==</span><span style="color: #3366CC;">&quot;&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #003366; font-weight: bold;">var</span> pass_new_field <span style="color: #339933;">=</span> document.<span style="color: #660066;">createElement</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;input&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            pass_new_field.<span style="color: #000066;">name</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;password&quot;</span><span style="color: #339933;">;</span>
            pass_new_field.<span style="color: #660066;">id</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;password&quot;</span><span style="color: #339933;">;</span>
&nbsp;
            pass_new_field.<span style="color: #660066;">type</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;text&quot;</span><span style="color: #339933;">;</span>
            pass_new_field.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;Password&quot;</span><span style="color: #339933;">;</span>
&nbsp;
            pass_new_field.<span style="color: #660066;">onclick</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>
                change_pass_field_type_topass<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
&nbsp;
            document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;password_field&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">removeChild</span><span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;password&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;password_field&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">appendChild</span><span style="color: #009900;">&#40;</span>pass_new_field<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: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span>
&nbsp;
&lt;/body&gt;
&nbsp;
&lt;/html&gt;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://rubensargsyan.com/change-input-type-from-text-to-password-for-ie/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Scrollable content by JavaScript</title>
		<link>http://rubensargsyan.com/scrollable-content-by-javascript/</link>
		<comments>http://rubensargsyan.com/scrollable-content-by-javascript/#comments</comments>
		<pubDate>Tue, 11 Jan 2011 18:54:20 +0000</pubDate>
		<dc:creator>Ruben Sargsyan</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[scrollable content]]></category>

		<guid isPermaLink="false">http://rubensargsyan.com/?p=567</guid>
		<description><![CDATA[This is a scrollable content example created by JavaScript: &#60;html&#62; &#160; &#60;head&#62; &#60;title&#62;Scrollable Content&#60;/title&#62; &#60;/head&#62; &#160; &#60;body&#62; &#160; &#60;script type=&#34;text/javascript&#34;&#62; function up&#40;&#41;&#123; if&#40;parseInt&#40;document.getElementById&#40;&#34;text&#34;&#41;.style.marginTop&#41;-5&#62;=parseInt&#40;&#34;-&#34;+document.getElementById&#40;&#34;text&#34;&#41;.offsetHeight&#41;+300&#41;&#123; document.getElementById&#40;&#34;text&#34;&#41;.style.marginTop = &#40;parseInt&#40;document.getElementById&#40;&#34;text&#34;&#41;.style.marginTop&#41;-5&#41;+&#34;px&#34;; &#125; &#125; &#160; function down&#40;&#41;&#123; if&#40;parseInt&#40;document.getElementById&#40;&#34;text&#34;&#41;.style.marginTop&#41;+5&#60;=0&#41;&#123; document.getElementById&#40;&#34;text&#34;&#41;.style.marginTop = &#40;parseInt&#40;document.getElementById&#40;&#34;text&#34;&#41;.style.marginTop&#41;+5&#41;+&#34;px&#34;; &#125; &#125; &#60;/script&#62; &#160; &#60;div id=&#34;scrollable_content&#34; style=&#34;width: 300px; height: 300px; overflow: hidden; font-size: 15px; line-height: 15px;&#34;&#62; &#60;div id=&#34;text&#34; style=&#34;margin-top: 0px;&#34;&#62;Lorem [...]]]></description>
			<content:encoded><![CDATA[<p>This is a scrollable content example created by JavaScript:<span id="more-567"></span></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">&lt;html&gt;
&nbsp;
&lt;head&gt;
  &lt;title&gt;Scrollable Content&lt;/title&gt;
&lt;/head&gt;
&nbsp;
&lt;body&gt;
&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: #003366; font-weight: bold;">function</span> up<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>parseInt<span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;text&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">style</span>.<span style="color: #660066;">marginTop</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #CC0000;">5</span><span style="color: #339933;">&gt;=</span>parseInt<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;-&quot;</span><span style="color: #339933;">+</span>document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;text&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">offsetHeight</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #CC0000;">300</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;text&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">style</span>.<span style="color: #660066;">marginTop</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>parseInt<span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;text&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">style</span>.<span style="color: #660066;">marginTop</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #CC0000;">5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;px&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">function</span> down<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>parseInt<span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;text&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">style</span>.<span style="color: #660066;">marginTop</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #CC0000;">5</span><span style="color: #339933;">&lt;=</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;text&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">style</span>.<span style="color: #660066;">marginTop</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>parseInt<span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;text&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">style</span>.<span style="color: #660066;">marginTop</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #CC0000;">5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;px&quot;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span>
&nbsp;
&lt;div id=&quot;scrollable_content&quot; style=&quot;width: 300px; height: 300px; overflow: hidden; font-size: 15px; line-height: 15px;&quot;&gt;
    &lt;div id=&quot;text&quot; style=&quot;margin-top: 0px;&quot;&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.&lt;br /&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.&lt;br /&gt;Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.&lt;/div&gt;
&lt;/div&gt;
&nbsp;
&lt;div&gt;&lt;img src=&quot;up.png&quot; alt=&quot;up&quot; style=&quot;cursor: pointer&quot; onclick=&quot;up();&quot; /&gt; &lt;img src=&quot;down.png&quot; alt=&quot;down&quot; style=&quot;cursor: pointer&quot; onclick=&quot;down();&quot; /&gt;&lt;/div&gt;
&nbsp;
&lt;/body&gt;
&nbsp;
&lt;/html&gt;</pre></div></div>

<h2>Icons</h2>
<p><img src="http://rubensargsyan.com/wp-content/uploads/2011/01/up.png" alt="" title="up" width="10" height="10" class="alignnone size-full wp-image-569" /> <img src="http://rubensargsyan.com/wp-content/uploads/2011/01/down.png" alt="" title="down" width="10" height="10" class="alignnone size-full wp-image-570" /></p>
]]></content:encoded>
			<wfw:commentRss>http://rubensargsyan.com/scrollable-content-by-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Count of all external links of the web page</title>
		<link>http://rubensargsyan.com/count-of-all-external-links-of-the-web-page/</link>
		<comments>http://rubensargsyan.com/count-of-all-external-links-of-the-web-page/#comments</comments>
		<pubDate>Tue, 24 Aug 2010 11:40:40 +0000</pubDate>
		<dc:creator>Ruben Sargsyan</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[counter]]></category>
		<category><![CDATA[external links]]></category>

		<guid isPermaLink="false">http://rubensargsyan.com/?p=402</guid>
		<description><![CDATA[This is a JavaScript script for counting all external links of the web page. Just add this script after the tag &#60;/body&#62;: &#60;script type=&#34;text/javascript&#34;&#62; var all_a = document.getElementsByTagName&#40;&#34;a&#34;&#41;; &#160; var this_link = window.location.toString&#40;&#41;; this_link = this_link.substr&#40;7,parseInt&#40;this_link.indexOf&#40;&#34;/&#34;,7&#41;-7&#41;&#41;; &#160; var external_links_count = 0; &#160; for&#40;var i=0; i&#60;all_a.length; i++&#41;&#123; if&#40;all_a&#91;i&#93;.href.indexOf&#40;this_link&#41;==-1&#41;&#123; external_links_count++; &#125; &#125; &#160; alert&#40;&#34;External links count is: [...]]]></description>
			<content:encoded><![CDATA[<p>This is a JavaScript script for counting all external links of the web page<span id="more-402"></span>. Just add this script after the tag &lt;/body&gt;:</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: #003366; font-weight: bold;">var</span> all_a <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;a&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> this_link <span style="color: #339933;">=</span> window.<span style="color: #660066;">location</span>.<span style="color: #660066;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
this_link <span style="color: #339933;">=</span> this_link.<span style="color: #660066;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">7</span><span style="color: #339933;">,</span>parseInt<span style="color: #009900;">&#40;</span>this_link.<span style="color: #660066;">indexOf</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;/&quot;</span><span style="color: #339933;">,</span><span style="color: #CC0000;">7</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">-</span><span style="color: #CC0000;">7</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> external_links_count <span style="color: #339933;">=</span> <span style="color: #CC0000;">0</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i<span style="color: #339933;">&lt;</span>all_a.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</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>all_a<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">href</span>.<span style="color: #660066;">indexOf</span><span style="color: #009900;">&#40;</span>this_link<span style="color: #009900;">&#41;</span><span style="color: #339933;">==-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        external_links_count<span style="color: #339933;">++;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;External links count is: &quot;</span><span style="color: #339933;">+</span>external_links_count<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>

]]></content:encoded>
			<wfw:commentRss>http://rubensargsyan.com/count-of-all-external-links-of-the-web-page/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Countdown Clock</title>
		<link>http://rubensargsyan.com/countdown-clock/</link>
		<comments>http://rubensargsyan.com/countdown-clock/#comments</comments>
		<pubDate>Wed, 21 Jul 2010 12:09:20 +0000</pubDate>
		<dc:creator>Ruben Sargsyan</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[clock]]></category>
		<category><![CDATA[countdown]]></category>

		<guid isPermaLink="false">http://rubensargsyan.com/?p=390</guid>
		<description><![CDATA[This script is an example of countdown clock. You can set seconds and start countdown. &#60;html&#62; &#160; &#60;head&#62; &#60;title&#62;Countdown Clock&#60;/title&#62; &#160; &#60;script type=&#34;text/javascript&#34;&#62; function convert&#40;&#41;&#123; var seconds = document.getElementById&#40;&#34;inputted_seconds&#34;&#41;.value; &#160; if&#40;isNaN&#40;seconds&#41;&#41;&#123; alert&#40;&#34;Please enter a valid number.&#34;&#41;; &#125;else&#123; document.getElementById&#40;&#34;inputted_seconds&#34;&#41;.setAttribute&#40;&#34;disabled&#34;,&#34;disabled&#34;&#41;; document.getElementById&#40;&#34;start&#34;&#41;.setAttribute&#40;&#34;disabled&#34;,&#34;disabled&#34;&#41;; &#160; var days = seconds/60/60/24; days = parseInt&#40;days.toString&#40;&#41;&#41;; &#160; seconds = seconds - days*24*60*60; &#160; var [...]]]></description>
			<content:encoded><![CDATA[<p>This script is an example of countdown clock. You can set seconds and start countdown<span id="more-390"></span>.</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">&lt;html&gt;
&nbsp;
&lt;head&gt;
  &lt;title&gt;Countdown Clock&lt;/title&gt;
&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: #003366; font-weight: bold;">function</span> convert<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;">var</span> seconds <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;inputted_seconds&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">value</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>isNaN<span style="color: #009900;">&#40;</span>seconds<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Please enter a valid number.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">else</span><span style="color: #009900;">&#123;</span>
        document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;inputted_seconds&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;disabled&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;disabled&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;start&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">setAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;disabled&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;disabled&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #003366; font-weight: bold;">var</span> days <span style="color: #339933;">=</span> seconds<span style="color: #339933;">/</span><span style="color: #CC0000;">60</span><span style="color: #339933;">/</span><span style="color: #CC0000;">60</span><span style="color: #339933;">/</span><span style="color: #CC0000;">24</span><span style="color: #339933;">;</span>
        days <span style="color: #339933;">=</span> parseInt<span style="color: #009900;">&#40;</span>days.<span style="color: #660066;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        seconds <span style="color: #339933;">=</span> seconds <span style="color: #339933;">-</span> days<span style="color: #339933;">*</span><span style="color: #CC0000;">24</span><span style="color: #339933;">*</span><span style="color: #CC0000;">60</span><span style="color: #339933;">*</span><span style="color: #CC0000;">60</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #003366; font-weight: bold;">var</span> hours <span style="color: #339933;">=</span> seconds<span style="color: #339933;">/</span><span style="color: #CC0000;">60</span><span style="color: #339933;">/</span><span style="color: #CC0000;">60</span><span style="color: #339933;">;</span>
        hours <span style="color: #339933;">=</span> parseInt<span style="color: #009900;">&#40;</span>hours.<span style="color: #660066;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        seconds <span style="color: #339933;">=</span> seconds <span style="color: #339933;">-</span> hours<span style="color: #339933;">*</span><span style="color: #CC0000;">60</span><span style="color: #339933;">*</span><span style="color: #CC0000;">60</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #003366; font-weight: bold;">var</span> minutes <span style="color: #339933;">=</span> seconds<span style="color: #339933;">/</span><span style="color: #CC0000;">60</span><span style="color: #339933;">;</span>
        minutes <span style="color: #339933;">=</span> parseInt<span style="color: #009900;">&#40;</span>minutes.<span style="color: #660066;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        seconds <span style="color: #339933;">=</span> seconds <span style="color: #339933;">-</span> minutes<span style="color: #339933;">*</span><span style="color: #CC0000;">60</span><span style="color: #339933;">;</span>
&nbsp;
        document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;countdown_clock&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> days<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;d &quot;</span><span style="color: #339933;">+</span>hours<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;h &quot;</span><span style="color: #339933;">+</span>minutes<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;m &quot;</span><span style="color: #339933;">+</span>seconds<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;s&quot;</span><span style="color: #339933;">;</span>
&nbsp;
&nbsp;
        t <span style="color: #339933;">=</span> setTimeout<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;start_countdown(&quot;</span><span style="color: #339933;">+</span>days<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;,&quot;</span><span style="color: #339933;">+</span>hours<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;,&quot;</span><span style="color: #339933;">+</span>minutes<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;,&quot;</span><span style="color: #339933;">+</span>seconds<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;)&quot;</span><span style="color: #339933;">,</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #003366; font-weight: bold;">function</span> start_countdown<span style="color: #009900;">&#40;</span>days<span style="color: #339933;">,</span>hours<span style="color: #339933;">,</span>minutes<span style="color: #339933;">,</span>seconds<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>seconds<span style="color: #339933;">==-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            minutes<span style="color: #339933;">--;</span>
            seconds <span style="color: #339933;">=</span> <span style="color: #CC0000;">59</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>minutes<span style="color: #339933;">==-</span><span style="color: #CC0000;">1</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            hours<span style="color: #339933;">--;</span>
            minutes <span style="color: #339933;">=</span> <span style="color: #CC0000;">59</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #009900;">&#125;</span>
        <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>hours<span style="color: #339933;">==-</span><span style="color: #CC0000;">1</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>days<span style="color: #339933;">&gt;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                days<span style="color: #339933;">--;</span>
                hours <span style="color: #339933;">=</span> <span style="color: #CC0000;">23</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;countdown_clock&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> days<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;d &quot;</span><span style="color: #339933;">+</span>hours<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;h &quot;</span><span style="color: #339933;">+</span>minutes<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;m &quot;</span><span style="color: #339933;">+</span>seconds<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;s&quot;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000066; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>days<span style="color: #339933;">==</span><span style="color: #CC0000;">0</span> <span style="color: #339933;">&amp;&amp;</span> hours<span style="color: #339933;">==</span><span style="color: #CC0000;">0</span> <span style="color: #339933;">&amp;&amp;</span> minutes<span style="color: #339933;">==</span><span style="color: #CC0000;">0</span> <span style="color: #339933;">&amp;&amp;</span> seconds<span style="color: #339933;">==</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
            <span style="color: #000066;">alert</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;Countdown is finished.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;inputted_seconds&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">removeAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;disabled&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;start&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">removeAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;disabled&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;countdown_clock&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> <span style="color: #3366CC;">&quot;Countdown is finished.&quot;</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span><span style="color: #000066; font-weight: bold;">else</span><span style="color: #009900;">&#123;</span>
            seconds<span style="color: #339933;">--;</span>
            t <span style="color: #339933;">=</span> setTimeout<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;start_countdown(&quot;</span><span style="color: #339933;">+</span>days<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;,&quot;</span><span style="color: #339933;">+</span>hours<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;,&quot;</span><span style="color: #339933;">+</span>minutes<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;,&quot;</span><span style="color: #339933;">+</span>seconds<span style="color: #339933;">+</span><span style="color: #3366CC;">&quot;)&quot;</span><span style="color: #339933;">,</span><span style="color: #CC0000;">1000</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: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span>
&lt;/head&gt;
&nbsp;
&lt;body&gt;
&nbsp;
&lt;label for=&quot;inputted_seconds&quot;&gt;Input Seconds&lt;/label&gt; &lt;input type=&quot;text&quot; id=&quot;inputted_seconds&quot; /&gt; &lt;input type=&quot;button&quot; id=&quot;start&quot; value=&quot;Start Countdown&quot; onclick=&quot;convert();&quot; /&gt;
&nbsp;
&lt;div id=&quot;countdown_clock&quot;&gt;&lt;/div&gt;
&nbsp;
&lt;/body&gt;
&nbsp;
&lt;/html&gt;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://rubensargsyan.com/countdown-clock/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Grayscale</title>
		<link>http://rubensargsyan.com/grayscale/</link>
		<comments>http://rubensargsyan.com/grayscale/#comments</comments>
		<pubDate>Sat, 20 Mar 2010 13:50:50 +0000</pubDate>
		<dc:creator>Ruben Sargsyan</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Grayscale]]></category>
		<category><![CDATA[image manipulation]]></category>

		<guid isPermaLink="false">http://rubensargsyan.com/?p=318</guid>
		<description><![CDATA[This is an image manipulation script that makes the selected photos grayscale and in the case of mouseover the colors are restored. It is easy to use, just put &#8220;grayscale&#8221; as the classes of the images. It used PHP and JavaScript for developing the script. How To Use: 1. Include grayscale.js: &#60;script src=&#8221;grayscale/grayscale.js&#8221; type=&#8221;text/javascript&#8221;&#62;&#60;/script&#62; 2. [...]]]></description>
			<content:encoded><![CDATA[<p>This is an image manipulation script that makes the selected photos grayscale and in the case of mouseover the colors are restored. It is easy to use, just put &#8220;grayscale&#8221; as the classes of the images. It used PHP and JavaScript for developing the script.<span id="more-318"></span></p>
<h2>How To Use:</h2>
<p>1. Include grayscale.js:</p>
<div style="color: #993300">&lt;script src=&#8221;grayscale/grayscale.js&#8221; type=&#8221;text/javascript&#8221;&gt;&lt;/script&gt;</div>
<p>2. Put &#8220;grayscale&#8221; as the classes of the images.</p>
<h2>Demo:</h2>
<p><a href="http://rubensargsyan.com/demo/grayscale/" target="_blank">Demo</a></p>
<h2>Version:</h2>
<p>1.0</p>
<h2>License:</h2>
<p><a rel="license" href="http://creativecommons.org/licenses/by/3.0/us/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by/3.0/us/88x31.png" /></a><br /><span xmlns:dc="http://purl.org/dc/elements/1.1/" href="http://purl.org/dc/dcmitype/Text" property="dc:title" rel="dc:type">Grayscale</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="http://rubensargsyan.com/" property="cc:attributionName" rel="cc:attributionURL">Ruben Sargsyan</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/3.0/us/">Creative Commons Attribution 3.0 United States License</a>.<br />Based on a work at <a xmlns:dc="http://purl.org/dc/elements/1.1/" href="http://rubensargsyan.com/grayscale/" rel="dc:source">rubensargsyan.com</a>.</p>
<h2>Download:</h2>
<p><a href="http://rubensargsyan.com/downloads/grayscale.zip">From rubensargsyan.com</a></p>
<h2>Donate:</h2>
<p>If you find this plugin useful to you, please consider making a small donation to help contribute to further development. Thanks for your kind support!<br />
<a href="http://rubensargsyan.com/donate/"><img src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" border="0" alt="Donate" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://rubensargsyan.com/grayscale/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Text counter by JavaScript</title>
		<link>http://rubensargsyan.com/text-counter-by-javascript/</link>
		<comments>http://rubensargsyan.com/text-counter-by-javascript/#comments</comments>
		<pubDate>Thu, 11 Feb 2010 10:36:47 +0000</pubDate>
		<dc:creator>Ruben Sargsyan</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[counter]]></category>
		<category><![CDATA[text]]></category>

		<guid isPermaLink="false">http://rubensargsyan.com/?p=270</guid>
		<description><![CDATA[This is an example for adding a counter to the inputing texts of tags &#60;textarea&#62; and &#60;input&#62;: &#60;html&#62; &#160; &#60;head&#62; &#60;title&#62;Text Counter&#60;/title&#62; &#160; &#60;script type=&#34;text/javascript&#34;&#62; function text_counter&#40;textfield_id,counter_id,count&#41;&#123; count = parseInt&#40;count&#41;; &#160; document.getElementById&#40;counter_id&#41;.innerHTML = count; &#160; document.getElementById&#40;textfield_id&#41;.onpropertychange = function&#40;&#41;&#123; text_count_changed&#40;textfield_id,counter_id,count&#41;; &#125; &#125; &#160; function text_count_changed&#40;textfield_id,counter_id,count&#41;&#123; if&#40;count-parseInt&#40;document.getElementById&#40;textfield_id&#41;.value.length&#41;&#60;0&#41;&#123; document.getElementById&#40;textfield_id&#41;.value = document.getElementById&#40;textfield_id&#41;.value.substr&#40;0,count&#41;; &#125; &#160; document.getElementById&#40;counter_id&#41;.innerHTML = count-parseInt&#40;document.getElementById&#40;textfield_id&#41;.value.length&#41;; &#125; &#60;/script&#62; [...]]]></description>
			<content:encoded><![CDATA[<p>This is an example for adding a counter to the inputing texts of tags &lt;textarea&gt; and &lt;input&gt;:<span id="more-270"></span></p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">&lt;html&gt;
&nbsp;
&lt;head&gt;
  &lt;title&gt;Text Counter&lt;/title&gt;
&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: #003366; font-weight: bold;">function</span> text_counter<span style="color: #009900;">&#40;</span>textfield_id<span style="color: #339933;">,</span>counter_id<span style="color: #339933;">,</span>count<span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
    count <span style="color: #339933;">=</span> parseInt<span style="color: #009900;">&#40;</span>count<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span>counter_id<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> count<span style="color: #339933;">;</span>
&nbsp;
    document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span>textfield_id<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">onpropertychange</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>
        text_count_changed<span style="color: #009900;">&#40;</span>textfield_id<span style="color: #339933;">,</span>counter_id<span style="color: #339933;">,</span>count<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
  <span style="color: #009900;">&#125;</span>
&nbsp;
  <span style="color: #003366; font-weight: bold;">function</span> text_count_changed<span style="color: #009900;">&#40;</span>textfield_id<span style="color: #339933;">,</span>counter_id<span style="color: #339933;">,</span>count<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>count<span style="color: #339933;">-</span>parseInt<span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span>textfield_id<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">value</span>.<span style="color: #660066;">length</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">&lt;</span><span style="color: #CC0000;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span>textfield_id<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">value</span> <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span>textfield_id<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">value</span>.<span style="color: #660066;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #CC0000;">0</span><span style="color: #339933;">,</span>count<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span>counter_id<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">innerHTML</span> <span style="color: #339933;">=</span> count<span style="color: #339933;">-</span>parseInt<span style="color: #009900;">&#40;</span>document.<span style="color: #660066;">getElementById</span><span style="color: #009900;">&#40;</span>textfield_id<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">value</span>.<span style="color: #660066;">length</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #009900;">&#125;</span>
  <span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span>
&lt;/head&gt;
&nbsp;
&lt;body&gt;
&lt;p&gt;
<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>inputtext_approving_chars_count <span style="color: #339933;">=</span> <span style="color: #CC0000;">10</span><span style="color: #339933;">;&lt;/</span>script<span style="color: #339933;">&gt;</span>
&lt;input type=&quot;text&quot; id=&quot;inputtext&quot; oninput='text_count_changed(&quot;inputtext&quot;,&quot;inputtext_counter&quot;,inputtext_approving_chars_count);'&gt; &lt;span id=&quot;inputtext_counter&quot;&gt;&lt;/span&gt;
<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>text_counter<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;inputtext&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;inputtext_counter&quot;</span><span style="color: #339933;">,</span>inputtext_approving_chars_count<span style="color: #009900;">&#41;</span><span style="color: #339933;">;&lt;/</span>script<span style="color: #339933;">&gt;</span>
&lt;/p&gt;
&nbsp;
&lt;p&gt;
<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>textfield_approving_chars_count <span style="color: #339933;">=</span> <span style="color: #CC0000;">255</span><span style="color: #339933;">;&lt;/</span>script<span style="color: #339933;">&gt;</span>
&lt;textarea id=&quot;textfield&quot; cols=&quot;50&quot; rows=&quot;10&quot; oninput='text_count_changed(&quot;textfield&quot;,&quot;textfield_counter&quot;,textfield_approving_chars_count);'&gt;&lt;/textarea&gt; &lt;span id=&quot;textfield_counter&quot;&gt;&lt;/span&gt;
<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>text_counter<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;textfield&quot;</span><span style="color: #339933;">,</span><span style="color: #3366CC;">&quot;textfield_counter&quot;</span><span style="color: #339933;">,</span>textfield_approving_chars_count<span style="color: #009900;">&#41;</span><span style="color: #339933;">;&lt;/</span>script<span style="color: #339933;">&gt;</span>
&lt;/p&gt;
&nbsp;
&lt;/body&gt;
&nbsp;
&lt;/html&gt;</pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://rubensargsyan.com/text-counter-by-javascript/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>The Last Visited Pages</title>
		<link>http://rubensargsyan.com/the-last-visited-pages/</link>
		<comments>http://rubensargsyan.com/the-last-visited-pages/#comments</comments>
		<pubDate>Sun, 17 Jan 2010 08:28:57 +0000</pubDate>
		<dc:creator>Ruben Sargsyan</dc:creator>
				<category><![CDATA[DOM]]></category>
		<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[links]]></category>
		<category><![CDATA[the last visited pages]]></category>

		<guid isPermaLink="false">http://rubensargsyan.com/?p=239</guid>
		<description><![CDATA[Setting this script on your website will give your visitors the great opportunity to see their last visited pages of your website. The visited pages links are created by using DOM and JavaScript. Script is working by the Cookies (the visited pages are kept for example about a month &#8211; the period is decided by [...]]]></description>
			<content:encoded><![CDATA[<p>Setting this script on your website will give your visitors the great opportunity to see their last visited pages of your website. The visited pages links are created by using DOM and JavaScript. Script is working by the Cookies (the visited pages are kept for example about a month &#8211; the period is decided by you). The quantity of the shown links are set by you. So, this is a very effective and comfortable script, that will be very pleasant for the visitors of your website.<span id="more-239"></span></p>
<h2>How To Use:</h2>
<p>1. Copy the <a href="http://rubensargsyan.com/downloads/the_last_visited_pages/the_last_visited_pages.js">the_last_visited_pages.js</a> and <a href="http://rubensargsyan.com/downloads/the_last_visited_pages/the_last_visited_pages.css">the_last_visited_pages.css</a> into your website directory.</p>
<p>2. Write in the &lt;head&gt;&lt;/head&gt;<br />
<span style="color: #993300;">&lt;link rel=&#8221;stylesheet&#8221; href=&#8221;the_last_visited_pages.css&#8221; type=&#8221;text/css&#8221; /&gt;<br />
&lt;script src=&#8221;the_last_visited_pages.js&#8221; type=&#8221;text/javascript&#8221;&gt;&lt;/script&gt;</span></p>
<p>3. Set <span style="color: #993300;">&lt;div id=&#8221;the_last_visited_pages&#8221;&gt;&lt;/div&gt;</span> where you want to show the last visited pages of the visitor.</p>
<p>4. Add <span style="color: #993300;">&lt;script type=&#8221;text/javascript&#8221;&gt;start_the_last_visited_pages();&lt;/script&gt;</span> just after &lt;/body&gt;</p>
<h2>How To Customize:</h2>
<p>You can use CSS to style it. Edit the code in the_last_visited_pages.css</p>
<h2>Version:</h2>
<p>1.0</p>
<h2>License:</h2>
<p><a rel="license" href="http://creativecommons.org/licenses/by/3.0/"><img alt="Creative Commons License" style="border-width:0" src="http://i.creativecommons.org/l/by/3.0/88x31.png" /></a><br /><span xmlns:dc="http://purl.org/dc/elements/1.1/" property="dc:title">The Last Visited Pages</span> by <a xmlns:cc="http://creativecommons.org/ns#" href="http://rubensargsyan.com/" property="cc:attributionName" rel="cc:attributionURL">Ruben Sargsyan</a> is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by/3.0/">Creative Commons Attribution 3.0 Unported License</a>.<br />Based on a work at <a xmlns:dc="http://purl.org/dc/elements/1.1/" href="http://rubensargsyan.com/the-last-visited-pages/" rel="dc:source">rubensargsyan.com</a>.</p>
<h2>Donate:</h2>
<p>If you find this plugin useful to you, please consider making a small donation to help contribute to further development. Thanks for your kind support!<br />
<a href="http://rubensargsyan.com/donate/"><img src="https://www.paypal.com/en_US/i/btn/btn_donate_LG.gif" border="0" alt="Donate" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://rubensargsyan.com/the-last-visited-pages/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Disable all links by javascript</title>
		<link>http://rubensargsyan.com/disable-all-links-by-javascript/</link>
		<comments>http://rubensargsyan.com/disable-all-links-by-javascript/#comments</comments>
		<pubDate>Mon, 11 Jan 2010 16:45:25 +0000</pubDate>
		<dc:creator>Ruben Sargsyan</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[links]]></category>

		<guid isPermaLink="false">http://rubensargsyan.com/?p=232</guid>
		<description><![CDATA[To disable all links of a web page add the script bellow just after &#60;/body&#62; &#60;script type=&#34;text/javascript&#34;&#62; var all_links = document.getElementsByTagName&#40;&#34;a&#34;&#41;; &#160; for&#40;var i=0; i&#60;all_links.length; i++&#41;&#123; all_links&#91;i&#93;.removeAttribute&#40;&#34;href&#34;&#41;; &#125; &#60;/script&#62;]]></description>
			<content:encoded><![CDATA[<p>To disable all links of a web page add the script bellow just after &lt;/body&gt;<span id="more-232"></span></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: #003366; font-weight: bold;">var</span> all_links <span style="color: #339933;">=</span> document.<span style="color: #660066;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;a&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000066; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">var</span> i<span style="color: #339933;">=</span><span style="color: #CC0000;">0</span><span style="color: #339933;">;</span> i<span style="color: #339933;">&lt;</span>all_links.<span style="color: #660066;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
        all_links<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #660066;">removeAttribute</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;href&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://rubensargsyan.com/disable-all-links-by-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Passing time by JavaScript</title>
		<link>http://rubensargsyan.com/passing-time-by-javascript/</link>
		<comments>http://rubensargsyan.com/passing-time-by-javascript/#comments</comments>
		<pubDate>Fri, 18 Dec 2009 08:00:11 +0000</pubDate>
		<dc:creator>Ruben Sargsyan</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[passing time]]></category>

		<guid isPermaLink="false">http://rubensargsyan.com/?p=182</guid>
		<description><![CDATA[This script shows the passing time from the date you wish. &#60;html&#62; &#60;head&#62; &#60;title&#62;Passing time&#60;/title&#62; &#160; &#60;script type=&#34;text/javascript&#34;&#62; var from_date = &#34;Dec 18, 2009 12:00:00&#34;; // Set the date from which the passing time will be shown &#160; var d = new Date&#40;&#41;; var current_time = d.getTime&#40;&#41;; &#160; var from_time = Date.parse&#40;from_date&#41;; &#160; var diference_in_milliseconds [...]]]></description>
			<content:encoded><![CDATA[<p>This script shows the passing time from the date you wish.<span id="more-182"></span></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>html<span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span>head<span style="color: #339933;">&gt;</span>
        <span style="color: #339933;">&lt;</span>title<span style="color: #339933;">&gt;</span>Passing time<span style="color: #339933;">&lt;/</span>title<span style="color: #339933;">&gt;</span>
&nbsp;
        <span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
            var from_date <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;Dec 18, 2009 12:00:00&quot;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Set the date from which the passing time will be shown</span>
&nbsp;
            var d <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> <span style="color: #003399;">Date</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            var current_time <span style="color: #339933;">=</span> d.<span style="color: #006633;">getTime</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            var from_time <span style="color: #339933;">=</span> <span style="color: #003399;">Date</span>.<span style="color: #006633;">parse</span><span style="color: #009900;">&#40;</span>from_date<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            var diference_in_milliseconds <span style="color: #339933;">=</span> current_time <span style="color: #339933;">-</span> from_time<span style="color: #339933;">;</span>
&nbsp;
            var passed_days <span style="color: #339933;">=</span> diference_in_milliseconds<span style="color: #339933;">/</span><span style="color: #cc66cc;">1000</span><span style="color: #339933;">/</span><span style="color: #cc66cc;">60</span><span style="color: #339933;">/</span><span style="color: #cc66cc;">60</span><span style="color: #339933;">/</span><span style="color: #cc66cc;">24</span><span style="color: #339933;">;</span>
            passed_days <span style="color: #339933;">=</span> parseInt<span style="color: #009900;">&#40;</span>passed_days.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            rest_milliseconds <span style="color: #339933;">=</span> diference_in_milliseconds <span style="color: #339933;">-</span> passed_days<span style="color: #339933;">*</span><span style="color: #cc66cc;">24</span><span style="color: #339933;">*</span><span style="color: #cc66cc;">60</span><span style="color: #339933;">*</span><span style="color: #cc66cc;">60</span><span style="color: #339933;">*</span><span style="color: #cc66cc;">1000</span><span style="color: #339933;">;</span>
&nbsp;
            var passed_hours <span style="color: #339933;">=</span> rest_milliseconds<span style="color: #339933;">/</span><span style="color: #cc66cc;">1000</span><span style="color: #339933;">/</span><span style="color: #cc66cc;">60</span><span style="color: #339933;">/</span><span style="color: #cc66cc;">60</span><span style="color: #339933;">;</span>
            passed_hours <span style="color: #339933;">=</span> parseInt<span style="color: #009900;">&#40;</span>passed_hours.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            rest_milliseconds <span style="color: #339933;">=</span> rest_milliseconds <span style="color: #339933;">-</span> passed_hours<span style="color: #339933;">*</span><span style="color: #cc66cc;">60</span><span style="color: #339933;">*</span><span style="color: #cc66cc;">60</span><span style="color: #339933;">*</span><span style="color: #cc66cc;">1000</span><span style="color: #339933;">;</span>
&nbsp;
            var passed_minutes <span style="color: #339933;">=</span> rest_milliseconds<span style="color: #339933;">/</span><span style="color: #cc66cc;">1000</span><span style="color: #339933;">/</span><span style="color: #cc66cc;">60</span><span style="color: #339933;">;</span>
            passed_minutes <span style="color: #339933;">=</span> parseInt<span style="color: #009900;">&#40;</span>passed_minutes.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            rest_milliseconds <span style="color: #339933;">=</span> rest_milliseconds <span style="color: #339933;">-</span> passed_minutes<span style="color: #339933;">*</span><span style="color: #cc66cc;">60</span><span style="color: #339933;">*</span><span style="color: #cc66cc;">1000</span><span style="color: #339933;">;</span>
&nbsp;
            var passed_seconds <span style="color: #339933;">=</span> rest_milliseconds<span style="color: #339933;">/</span><span style="color: #cc66cc;">1000</span><span style="color: #339933;">;</span>
            passed_seconds <span style="color: #339933;">=</span> parseInt<span style="color: #009900;">&#40;</span>passed_seconds.<span style="color: #006633;">toString</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            var t<span style="color: #339933;">;</span> 
&nbsp;
            function passing_time<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>passed_seconds<span style="color: #339933;">==</span><span style="color: #cc66cc;">60</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                    passed_minutes <span style="color: #339933;">=</span> passed_minutes <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
                    passed_seconds <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
                <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>passed_minutes<span style="color: #339933;">==</span><span style="color: #cc66cc;">60</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                    passed_hours <span style="color: #339933;">=</span> passed_hours <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
                    passed_minutes <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
                <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>passed_hours<span style="color: #339933;">==</span><span style="color: #cc66cc;">24</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
                    passed_days <span style="color: #339933;">=</span> passed_days <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
                    passed_hours <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
                <span style="color: #009900;">&#125;</span>
&nbsp;
                document.<span style="color: #006633;">getElementById</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;passing_time&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #006633;">innerHTML</span> <span style="color: #339933;">=</span> passed_days<span style="color: #339933;">+</span><span style="color: #0000ff;">&quot; days, &quot;</span><span style="color: #339933;">+</span>passed_hours<span style="color: #339933;">+</span><span style="color: #0000ff;">&quot; hours, &quot;</span><span style="color: #339933;">+</span>passed_minutes<span style="color: #339933;">+</span><span style="color: #0000ff;">&quot; minutes, &quot;</span><span style="color: #339933;">+</span>passed_seconds<span style="color: #339933;">+</span><span style="color: #0000ff;">&quot; seconds.&quot;</span><span style="color: #339933;">;</span>
                passed_seconds <span style="color: #339933;">=</span> passed_seconds <span style="color: #339933;">+</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
                t <span style="color: #339933;">=</span> setTimeout<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;passing_time()&quot;</span>,<span style="color: #cc66cc;">1000</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>head<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;</span>body<span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;passing_time&quot;</span><span style="color: #339933;">&gt;&lt;/</span>div<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>body<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;</span>script<span style="color: #339933;">&gt;</span>passing_time<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;&lt;/</span>script<span style="color: #339933;">&gt;</span>
&nbsp;
<span style="color: #339933;">&lt;/</span>html<span style="color: #339933;">&gt;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://rubensargsyan.com/passing-time-by-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Check/uncheck checkboxes by JavaScript</title>
		<link>http://rubensargsyan.com/checkuncheck-checkboxes-by-javascript/</link>
		<comments>http://rubensargsyan.com/checkuncheck-checkboxes-by-javascript/#comments</comments>
		<pubDate>Tue, 01 Dec 2009 13:34:40 +0000</pubDate>
		<dc:creator>Ruben Sargsyan</dc:creator>
				<category><![CDATA[JavaScript]]></category>
		<category><![CDATA[check/uncheck]]></category>
		<category><![CDATA[checkboxes]]></category>

		<guid isPermaLink="false">http://rubensargsyan.com/?p=149</guid>
		<description><![CDATA[The easy way to check/uncheck checkboxes. Insert into &#60;head&#62;&#60;/head&#62; this script &#60;script type=&#34;text/javascript&#34;&#62; function check_all&#40;&#41;&#123; var all_inputs = document.getElementsByTagName&#40;&#34;input&#34;&#41;; &#160; for&#40;i=0; i&#60;all_inputs.length; i++&#41;&#123; if&#40;all_inputs&#91;i&#93;.type==&#34;checkbox&#34; &#38;&#38; all_inputs&#91;i&#93;.className==&#34;check_uncheck&#34;&#41;&#123; all_inputs&#91;i&#93;.checked = &#34;checked&#34;; &#125; &#125; &#125; &#160; function uncheck_all&#40;&#41;&#123; var all_inputs = document.getElementsByTagName&#40;&#34;input&#34;&#41;; &#160; for&#40;i=0; i&#60;all_inputs.length; i++&#41;&#123; if&#40;all_inputs&#91;i&#93;.type==&#34;checkbox&#34; &#38;&#38; all_inputs&#91;i&#93;.className==&#34;check_uncheck&#34;&#41;&#123; all_inputs&#91;i&#93;.checked = &#34;&#34;; &#125; &#125; &#125; &#60;/script&#62; then set [...]]]></description>
			<content:encoded><![CDATA[<p>The easy way to check/uncheck checkboxes. Insert into &lt;head&gt;&lt;/head&gt; this script<span id="more-149"></span></p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>script type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/javascript&quot;</span><span style="color: #339933;">&gt;</span>
function check_all<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
   var all_inputs <span style="color: #339933;">=</span> document.<span style="color: #006633;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;input&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i<span style="color: #339933;">&lt;</span>all_inputs.<span style="color: #006633;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>all_inputs<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #006633;">type</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;checkbox&quot;</span> <span style="color: #339933;">&amp;&amp;</span> all_inputs<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #006633;">className</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;check_uncheck&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
         all_inputs<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #006633;">checked</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;checked&quot;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
   <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
function uncheck_all<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
   var all_inputs <span style="color: #339933;">=</span> document.<span style="color: #006633;">getElementsByTagName</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;input&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
   <span style="color: #000000; font-weight: bold;">for</span><span style="color: #009900;">&#40;</span>i<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> i<span style="color: #339933;">&lt;</span>all_inputs.<span style="color: #006633;">length</span><span style="color: #339933;">;</span> i<span style="color: #339933;">++</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
      <span style="color: #000000; font-weight: bold;">if</span><span style="color: #009900;">&#40;</span>all_inputs<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #006633;">type</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;checkbox&quot;</span> <span style="color: #339933;">&amp;&amp;</span> all_inputs<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #006633;">className</span><span style="color: #339933;">==</span><span style="color: #0000ff;">&quot;check_uncheck&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
         all_inputs<span style="color: #009900;">&#91;</span>i<span style="color: #009900;">&#93;</span>.<span style="color: #006633;">checked</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;&quot;</span><span style="color: #339933;">;</span>
      <span style="color: #009900;">&#125;</span>
   <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #339933;">&lt;/</span>script<span style="color: #339933;">&gt;</span></pre></div></div>

<p>then set &#8220;check_uncheck&#8221; the classes of checkboxes which must check/uncheck (Example: <span style="color: #993300;">&lt;input type=&#8221;checkbox&#8221; name=&#8221;checkbox&#8221;&gt;</span>) and set onclick=&#8221;check_all()&#8221; to element on click which the checkboxes will be checked and onclick=&#8221;uncheck_all()&#8221; to element on click which the checkboxes will be unchecked (Example: <span style="color: #993300;">&lt;input type=&#8221;button&#8221; value=&#8221;Check&#8221; onclick=&#8221;check_all()&#8221;&gt; &lt;input type=&#8221;button&#8221; value=&#8221;Uncheck&#8221; onclick=&#8221;uncheck_all()&#8221;&gt;</span>).</p>
]]></content:encoded>
			<wfw:commentRss>http://rubensargsyan.com/checkuncheck-checkboxes-by-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

