<?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>TechnoBlogy &#187; Javascript</title>
	<atom:link href="http://technoblogy.net/category/technology/javascript/feed/" rel="self" type="application/rss+xml" />
	<link>http://technoblogy.net</link>
	<description>Technology with a Big difference</description>
	<lastBuildDate>Mon, 05 Dec 2011 17:29:42 +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>Traversing DOM using JavaScript</title>
		<link>http://technoblogy.net/traversing-dom-using-javascript-3/</link>
		<comments>http://technoblogy.net/traversing-dom-using-javascript-3/#comments</comments>
		<pubDate>Sun, 22 Nov 2009 07:20:52 +0000</pubDate>
		<dc:creator>Nauman</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[DOM]]></category>
		<category><![CDATA[insertion]]></category>
		<category><![CDATA[node]]></category>
		<category><![CDATA[XML]]></category>

		<guid isPermaLink="false">http://technoblogy.net/?p=342</guid>
		<description><![CDATA[The HTML DOM defines a standard way for accessing and manipulating HTML documents. The DOM presents an HTML document as a tree-structure expressed as an XML document. DOM is a language independent API, as it can be used in Java, .NET, JavaScript and many more. I will use it with JavaScript to for my sample [...]]]></description>
			<content:encoded><![CDATA[<p>The HTML DOM defines a standard way for accessing and manipulating HTML documents.</p>
<p>The DOM presents an HTML document as a tree-structure expressed as an XML document.</p>
<p>DOM is a language independent API, as it can be used in Java, .NET, JavaScript and many more. I will use it with JavaScript to for my sample code provided below.</p>
<p>When talking about DOM trees , you are really talking about a hierarchy of nodes. These are some objects  Inside XML(XHTML,HTML) document :</p>
<p>document -  is very top level node wich contains all other nodes</p>
<p>element  -  represents the contents of a start tag and end tag</p>
<p>Attr —  Represents an attribute name-value pair</p>
<p>Text — Represents plain text in an XML document contained within start and end tags  or inside of a CData Section</p>
<p>CDataSection — The object representation of &lt;![CDATA[ ]]&gt;. This node type may contain any symbols including quotes.</p>
<p>To manipulate this obects i.e makes changes in XML(XHTML, HTML) we have some properties and methods:</p>
<p>nodeName    -  The name of the node</p>
<p>nodeValue     -  The value of the node</p>
<p>nodeType     -  One of the node type constant values</p>
<p>ownerDocument  – Pointer to the document that this node belongs to</p>
<p>firstChild  -  Pointer to the first node in the childNodes list</p>
<p>lastChild  – Pointer to the last node in the childNodes list</p>
<p>childNodes – A list of all child nodes</p>
<p>previousSibling – Pointer to the previous sibling; null if this is the first sibling</p>
<p>nextSibling   – Pointer to the next sibling; null if this is the last  sibling</p>
<p>hasChildNodes()   – Returns true when childNodes contains one or more nodes</p>
<p>attributes  – Contains Attr objects representing an element’s attributes; only used for Element nodes</p>
<p>appendChild(node) -  Adds node to the end of childNodes</p>
<p>removeChild(node) -  Removes node from childNodes</p>
<p>replaceChild (newnode, oldnode)  –  Replaces oldnode in childNodes with  newnode</p>
<p>insertBefore (newnode, refnode)  — Inserts newnode before refnode in childnodes</p>
<p>Let’s do some example to demonstrate functions and properties mentioned before.</p>
<p>Adding nodes  using DOM:</p>
<p>In idex.html  we have form tag with textarea and submit button inside</p>
<blockquote><p>&lt;body&gt;</p>
<p>&lt;form action=”#”&gt;</p>
<p>&lt;p&gt;</p>
<p>&lt;textarea rows=”5″ cols=”30″&gt;</p>
<p>&lt;/textarea&gt;</p>
<p>&lt;br/&gt;</p>
<p>&lt;input value=”Add Text” /&gt;</p>
<p>&lt;/p&gt;</p>
<p>&lt;/form&gt;</p>
<p>&lt;/body&gt;</p></blockquote>
<p>In script.js addNode()  function is triggered on form submit it gets value of textarea, creates text node then paragraph tag and appends all these</p>
<p>as child of body tag.</p>
<blockquote><p>window.onload=initAll;</p>
<p>function initAll()</p>
<p>{</p>
<p>document.getElementById(“form1″).onsubmit=addNode;</p>
<p>}</p>
<p>function addNode()</p>
<p>{</p>
<p>var inText=document.getElementById(“textarea”).value;</p>
<p>var newText=document.createTextNode(inText);</p>
<p>var newGraf=document.createElement(“p”);</p>
<p>newGraf.appendChild(newText);</p>
<p>var docBody=document.getElementsByTagName(“body”)[0];</p>
<p>docBody.appendChild(newGraf);</p>
<p>return false;</p>
<p>}</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://technoblogy.net/traversing-dom-using-javascript-3/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>RGB-to-Hex Conversion</title>
		<link>http://technoblogy.net/rgb-to-hex-conversion/</link>
		<comments>http://technoblogy.net/rgb-to-hex-conversion/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 15:22:25 +0000</pubDate>
		<dc:creator>saim</dc:creator>
				<category><![CDATA[Javascript]]></category>
		<category><![CDATA[hex]]></category>
		<category><![CDATA[hexadecimal]]></category>
		<category><![CDATA[rgb]]></category>
		<category><![CDATA[rgbtohex]]></category>
		<category><![CDATA[tohex]]></category>

		<guid isPermaLink="false">http://technoblogy.net/rgb-to-hex-conversion/</guid>
		<description><![CDATA[Question is: How do I convert RGB values of a color to a hexadecimal string? The algorithm is as follows: make sure that RGB values are in the range 0&#8230;255, convert RGB values to hex strings, and then merge the three strings. Here is a script that does this conversion: function RGBtoHex(R,G,B) { return toHex(R)+toHex(G)+toHex(B); [...]]]></description>
			<content:encoded><![CDATA[<p>Question is: <strong>How do I convert RGB values of a color to a hexadecimal string?</strong></p>
<p>The algorithm is as follows: make sure that RGB values are in the range 0&#8230;255, convert RGB values to hex strings, and then merge the three strings.    <br />Here is a script that does this conversion:</p>
<blockquote><p>function RGBtoHex(R,G,B)      <br />{       <br />return toHex(R)+toHex(G)+toHex(B);       <br />}</p>
<p>function toHex(N)      <br />{       <br />if (N==null)       <br />return &quot;00&quot;;       <br />N=parseInt(N);       <br />if (N==0 || isNaN(N))       <br />return &quot;00&quot;;       <br />N=Math.max(0,N);       <br />N=Math.min(N,255);       <br />N=Math.round(N);       <br />return &quot;0123456789ABCDEF&quot;.charAt((N-N%16)/16)       <br />+ &quot;0123456789ABCDEF&quot;.charAt(N%16);       <br />}</p>
</blockquote>
<p>For reference and online example <a href="http://www.javascripter.net/faq/rgbtohex.htm">Click Me</a></p>
]]></content:encoded>
			<wfw:commentRss>http://technoblogy.net/rgb-to-hex-conversion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>charachter validation and count for a textbox &#8211; Javascript</title>
		<link>http://technoblogy.net/charachter-validation-and-count-for-a-textbox-javascript/</link>
		<comments>http://technoblogy.net/charachter-validation-and-count-for-a-textbox-javascript/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 14:32:05 +0000</pubDate>
		<dc:creator>Nauman</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[charachter]]></category>
		<category><![CDATA[textbox]]></category>
		<category><![CDATA[validation]]></category>

		<guid isPermaLink="false">http://technoblogy.net/charachter-validation-and-count-for-a-textbox-javascript/</guid>
		<description><![CDATA[Here I have provided a solution to put a counter for a textbox, that can be updated as each character typed into the textbox. This script will also validate the maximum character length allowed for a textbox. This script will also work when anyone copy/paste the text into the textbox. Textbox can be either single [...]]]></description>
			<content:encoded><![CDATA[<p>Here I have provided a solution to put a counter for a textbox, that can be updated as each character typed into the textbox. This script will also validate the maximum character length allowed for a textbox. This script will also work when anyone copy/paste the text into the textbox. Textbox can be either single line or multi line. Check the following script:</p>
<blockquote><p>&lt;!&#8211;[if gte mso 9]&gt; Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 &lt;![endif]&#8211;&gt;&lt;!&#8211;[if gte mso 9]&gt; &lt;![endif]&#8211;&gt;      <br />&lt;body&gt;       <br />&lt;form id=&quot;form1″ runat=&quot;server&quot;&gt;       <br />&lt;div&gt;       <br />&lt;asp:TextBox ID=&quot;TextBox1″ TextMode=&quot;multiLine&quot; MaxLength=&quot;100″ runat=&quot;server&quot; onkeyup=&quot;javascript:CharCounter(this.id);&quot; onblur=&quot;javascript:CharCounter(this.id);&quot;&gt;&lt;/asp:TextBox&gt;       <br />&lt;asp:Label ID=&quot;Label1″ runat=&quot;server&quot; Text=&quot;100 chars remaining&quot;&gt;&lt;/asp:Label&gt;       <br />&lt;/div&gt;       <br />&lt;script language=&quot;javascript&quot; type=&quot;text/javascript&quot;&gt;       <br />function CharCounter(textId)       <br />{       <br />var totalchar = &#8216;&lt;%= TextBox1.MaxLength %&gt;&#8217;;       <br />var txtbox = document.getElementById(textId);       <br />var lbl = document.getElementById(&#8216;&lt;% =Label1.ClientID %&gt;&#8217;);       <br />if(txtbox.value.length &gt; totalchar)       <br />{       <br />txtbox.value = txtbox.value.substring(0,totalchar);       <br />}       <br />lbl.innerText = (totalchar &#8211; txtbox.value.length) + &quot; chars remaining&quot; ;       <br />}       <br />&lt;/script&gt;       <br />&lt;/form&gt;       <br />&lt;/body&gt;&lt;!&#8211;[endif]&#8211;&gt;</p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://technoblogy.net/charachter-validation-and-count-for-a-textbox-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Enable/Disable DIV tags through Javascript</title>
		<link>http://technoblogy.net/enabledisable-div-tags-through-javascript/</link>
		<comments>http://technoblogy.net/enabledisable-div-tags-through-javascript/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 14:31:49 +0000</pubDate>
		<dc:creator>Nauman</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[asp.net]]></category>
		<category><![CDATA[div]]></category>
		<category><![CDATA[enable]]></category>

		<guid isPermaLink="false">http://technoblogy.net/enabledisable-div-tags-through-javascript/</guid>
		<description><![CDATA[Copy/Paste following javascript code snippet. &#60;script type=&#34;text/javascript&#34;&#62; function toggleAlert() { toggleDisabled(document.getElementById(&#34;content&#34;)); } function toggleDisabled(el) { try { el.disabled = el.disabled ? false : true; } catch(E){ } if (el.childNodes &#38;&#38; el.childNodes.length &#62; 0) { for (var x = 0; x &#60; el.childNodes.length; x++) { toggleDisabled(el.childNodes[x]); } } } &#60;/script&#62; Copy/Paste following HTML code in BODY [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Copy/Paste following javascript code snippet.</strong></p>
<blockquote><p>&lt;script type=&quot;text/javascript&quot;&gt;      <br />function toggleAlert() {       <br />toggleDisabled(document.getElementById(&quot;content&quot;));       <br />}       <br />function toggleDisabled(el) {       <br />try {       <br />el.disabled = el.disabled ? false : true;       <br />}       <br />catch(E){       <br />}       <br />if (el.childNodes &amp;&amp; el.childNodes.length &gt; 0) {       <br />for (var x = 0; x &lt; el.childNodes.length; x++) {       <br />toggleDisabled(el.childNodes[x]);       <br />}       <br />}       <br />}       <br />&lt;/script&gt;</p>
</blockquote>
<p><strong>Copy/Paste following HTML code in BODY tag: </strong></p>
<blockquote><p>&lt;div id=&quot;content&quot;&gt;      <br />&lt;table&gt;       <br />&lt;tr&gt;       <br />&lt;td&gt;&lt;input type=&quot;text&quot; name=&quot;foo&quot; /&gt;&lt;/td&gt;       <br />&lt;/tr&gt;       <br />&lt;tr&gt;       <br />&lt;td&gt;       <br />&lt;select name=&quot;bar&quot;&gt;       <br />&lt;option&gt;a&lt;/option&gt;       <br />&lt;option&gt;b&lt;/option&gt;       <br />&lt;option&gt;c&lt;/option&gt;       <br />&lt;/select&gt;       <br />&lt;/td&gt;       <br />&lt;/tr&gt;       <br />&lt;/table&gt;       <br />&lt;/div&gt;       <br />&lt;input type=&quot;checkbox&quot; value=&quot;toggleAlert()&quot; onclick=&quot;toggleAlert()&quot; /&gt;</p>
</blockquote>
]]></content:encoded>
			<wfw:commentRss>http://technoblogy.net/enabledisable-div-tags-through-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

