<?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>WHAT A LAMP &#187; JavaScript</title> <atom:link href="http://www.whatalamp.com/category/js/feed/" rel="self" type="application/rss+xml" /><link>http://www.whatalamp.com</link> <description>Full tips on a wide range of web technology.</description> <lastBuildDate>Mon, 03 Oct 2011 16:39:47 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.3.1</generator> <item><title>tablesorter 2.0.3</title><link>http://www.whatalamp.com/js/tablesorter-203/</link> <comments>http://www.whatalamp.com/js/tablesorter-203/#comments</comments> <pubDate>Tue, 14 Oct 2008 19:25:42 +0000</pubDate> <dc:creator>David</dc:creator> <category><![CDATA[JavaScript]]></category> <category><![CDATA[code]]></category> <category><![CDATA[HTML]]></category> <category><![CDATA[jQuery]]></category> <category><![CDATA[plugin]]></category> <category><![CDATA[sQL]]></category><guid
isPermaLink="false">http://www.whatalamp.com/?p=301</guid> <description><![CDATA[Table Sorter is a very handy plugin of jQuery. It release 2.0.3. I use it in many web-based programs.  Let&#8217;s have a look on the features. tablesorter is a jQuery plugin for turning a standard HTML table with THEAD and TBODY tags into a sortable table without page refreshes. tablesorter can successfully parse and sort [...]]]></description> <content:encoded><![CDATA[<p>Table Sorter is a very handy <a
href="http://www.whatalamp.com/tag/plugin/" class="st_tag internal_tag" rel="tag" title="Posts tagged with plugin">plugin</a> of <a
href="http://www.whatalamp.com/tag/jquery/" class="st_tag internal_tag" rel="tag" title="Posts tagged with jQuery">jQuery</a>. It release <a
href="http://tablesorter.com/docs/" target="_blank">2.0.3</a>.</p><p>I use it in many web-based programs.  Let&#8217;s have a look on the features.</p><blockquote><p>tablesorter is a <a
class="external" href="http://jquery.com/" target="_new">jQuery</a> plugin for turning a 	  	standard <a
href="http://www.whatalamp.com/tag/html/" class="st_tag internal_tag" rel="tag" title="Posts tagged with HTML">HTML</a> table with THEAD and TBODY tags into a sortable table without page refreshes.   	  	tablesorter can successfully parse and sort many types of data including linked data in a cell.  	  	 		It has many useful features including:</p><ul><li>Multi-column sorting</li><li>Parsers for sorting text, URIs, integers, currency, floats, IP addresses, dates (ISO, long and short formats), time.</li><li>Support for ROWSPAN and COLSPAN on TH elements</li><li>Support secondary &#8220;hidden&#8221; sorting (e.g., maintain alphabetical sort when sorting on other criteria)</li><li>Extensibility via <a
href="http://tablesorter.com/docs/example-widgets.html">widget system</a></li><li>Cross-browser: IE 6.0+, FF 2+, Safari 2.0+, Opera 9.0+</li><li>Small <a
href="http://www.whatalamp.com/tag/code/" class="st_tag internal_tag" rel="tag" title="Posts tagged with code">code</a> size</li></ul></blockquote><p>So I don&#8217;t need to implement <a
href="http://www.whatalamp.com/tag/sql/" class="st_tag internal_tag" rel="tag" title="Posts tagged with sQL">SQL</a> based data sorting or php based sorting. I use jQuery tablesorter 2.0.3 to sort data in table without coding.</p>]]></content:encoded> <wfw:commentRss>http://www.whatalamp.com/js/tablesorter-203/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>JavaScript Classes Comparison</title><link>http://www.whatalamp.com/js/javascript-classes-comparison/</link> <comments>http://www.whatalamp.com/js/javascript-classes-comparison/#comments</comments> <pubDate>Tue, 11 Dec 2007 19:45:08 +0000</pubDate> <dc:creator>David</dc:creator> <category><![CDATA[JavaScript]]></category> <category><![CDATA[framework]]></category> <category><![CDATA[function]]></category> <category><![CDATA[program]]></category><guid
isPermaLink="false">http://ref.g2soft.net/js/javascript-classes-comparison.html</guid> <description><![CDATA[There are more and more JavaScript Classes in front of programers. To choose one of the suitable is very important. Let me list some of them here: jQuery, Ext, MooTools, Prototype, YUI. Remy Sharp has gone through the jQuery and Prototype frameworks, which are probably the two closest to each other, and has done a [...]]]></description> <content:encoded><![CDATA[<p>There are more and more <a
href="http://www.whatalamp.com/tag/js/" class="st_tag internal_tag" rel="tag" title="Posts tagged with JavaScript">JavaScript</a> Classes in front of programers. To choose one of the suitable is very important.</p><p>Let me list some of them here: <a
href="http://jquery.com/">jQuery</a>, <a
href="http://extjs.com/">Ext</a>, <a
href="http://mootools.net/">MooTools</a>, <a
href="http://www.prototypejs.org/">Prototype</a>, <a
href="http://developer.yahoo.com/yui/">YUI</a>.</p><blockquote><p>Remy Sharp has gone through the <a
href="http://www.whatalamp.com/tag/jquery/" class="st_tag internal_tag" rel="tag" title="Posts tagged with jQuery">jQuery</a> and Prototype frameworks, which are probably the two closest to each other, and has done a side by side comparison of the frameworks by showing you how similar things work on both.</p><p>The presentation looks into the utility functions, selectors, DOM manipulation, DOM walking, <a
href="http://www.whatalamp.com/tag/events/" class="st_tag internal_tag" rel="tag" title="Posts tagged with events">events</a>, Ajax transport, and browser detection.</p></blockquote><p>There is also other posts tell something about:<br
/> <a
href="http://coderseye.com/2007/mootools-beats-jquery-and-ext-for-air.html"><strong> Mootools beats jQuery and Ext for AIR</strong></a><br
/> <strong><a
href="http://blogs.pathf.com/agileajax/2007/08/jquery-vs-proto.html">jQuery vs. Prototype: OO JavaScript with or without training wheels</a></strong><br
/> <strong><a
href="http://www.javascriptkata.com/2007/05/29/3-reasons-why-i-use-jquery/">3 reasons why I use jQuery</a></strong></p>]]></content:encoded> <wfw:commentRss>http://www.whatalamp.com/js/javascript-classes-comparison/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Events Handling</title><link>http://www.whatalamp.com/js/events-handling/</link> <comments>http://www.whatalamp.com/js/events-handling/#comments</comments> <pubDate>Thu, 12 Apr 2007 17:48:47 +0000</pubDate> <dc:creator>David</dc:creator> <category><![CDATA[JavaScript]]></category> <category><![CDATA[events]]></category><guid
isPermaLink="false">http://ref.g2soft.net/?p=77</guid> <description><![CDATA[By using JavaScript, we have the ability to create dynamic web pages. Events are actions that can be detected by JavaScript. Every element on a web page has certain events which can trigger JavaScript functions. For example, we can use the onClick event of a button element to indicate that a function will run when [...]]]></description> <content:encoded><![CDATA[<p>By using <a
href="http://www.whatalamp.com/tag/js/" class="st_tag internal_tag" rel="tag" title="Posts tagged with JavaScript">JavaScript</a>, we have the ability to create dynamic web pages. <a
href="http://www.whatalamp.com/tag/events/" class="st_tag internal_tag" rel="tag" title="Posts tagged with events">Events</a> are actions that can be detected by JavaScript.</p><p>Every element on a web page has certain events which can trigger JavaScript functions. For example, we can use the onClick event of a button element to indicate that a <a
href="http://www.whatalamp.com/tag/function/" class="st_tag internal_tag" rel="tag" title="Posts tagged with function">function</a> will run when a user clicks on the button. We define the events in the <a
href="http://www.whatalamp.com/tag/html/" class="st_tag internal_tag" rel="tag" title="Posts tagged with HTML">HTML</a> tags.</p><p>Examples of events:</p><p>* A mouse click<br
/> * A web page or an image loading<br
/> * Mousing over a hot spot on the web page<br
/> * Selecting an input box in an HTML form<br
/> * Submitting an HTML form<br
/> * A keystroke</p><p><span
id="more-163"></span><br
/> <strong>onload and onUnload</strong></p><p>The onload and onUnload events are triggered when the user enters or leaves the page.</p><p>The onload event is often used to check the visitor&#8217;s browser <a
href="http://www.whatalamp.com/tag/type/" class="st_tag internal_tag" rel="tag" title="Posts tagged with type">type</a> and browser <a
href="http://www.whatalamp.com/tag/version/" class="st_tag internal_tag" rel="tag" title="Posts tagged with version">version</a>, and load the proper <a
href="http://www.whatalamp.com/tag/version/" class="st_tag internal_tag" rel="tag" title="Posts tagged with version">version</a> of the web page based on the information.</p><p>Both the onload and onUnload events are also often used to deal with <a
href="http://www.whatalamp.com/tag/cookies/" class="st_tag internal_tag" rel="tag" title="Posts tagged with cookies">cookies</a> that should be set when a user enters or leaves a page. For example, you could have a <a
href="http://www.whatalamp.com/tag/popup/" class="st_tag internal_tag" rel="tag" title="Posts tagged with popup">popup</a> asking for the user&#8217;s name upon his first arrival to your page. The name is then stored in a cookie. Next time the visitor arrives at your page, you could have another <a
href="http://www.whatalamp.com/tag/popup/" class="st_tag internal_tag" rel="tag" title="Posts tagged with popup">popup</a> saying something like: &#8220;Welcome John Doe!&#8221;.</p><p><strong>onFocus, onBlur and onChange</strong></p><p>The onFocus, onBlur and onChange events are often used in combination with validation of form fields.</p><p>Below is an example of how to use the onChange event. The checkEmail() function will be called whenever the user changes the content of the field:</p><div
class="scode"> &lt;input type=&quot;text&quot; size=&quot;30&quot;<br
/> id=&quot;email&quot; onchange=&quot;checkEmail()&quot;&gt;;</div><p><strong>onSubmit</strong></p><p>The onSubmit event is used to validate ALL form fields before submitting it.</p><p>Below is an example of how to use the onSubmit event. The checkForm() function will be called when the user clicks the submit button in the form. If the field values are not accepted, the submit should be cancelled. The function checkForm() returns either true or false. If it returns true the form will be submitted, otherwise the submit will be cancelled:</p><div
class="scode"> &lt;form method=&quot;post&quot; action=&quot;xxx.htm&quot;<br
/> onsubmit=&quot;return checkForm()&quot;&gt;</div><p><strong>onMouseOver and onMouseOut</strong></p><p>onMouseOver and onMouseOut are often used to create &#8220;animated&#8221; buttons.</p><p>Below is an example of an onMouseOver event. An alert box appears when an onMouseOver event is detected:</p><div
class="scode"> &lt;a href=&quot;http://www.w3schools.com&quot;<br
/> onmouseover=&quot;alert(&#039;An onMouseOver event&#039;);return false&quot;&gt;<br
/> &lt;img src=&quot;w3schools.gif&quot; width=&quot;100&quot; height=&quot;30&quot;&gt;<br
/> &lt;/a&gt;</div>]]></content:encoded> <wfw:commentRss>http://www.whatalamp.com/js/events-handling/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Loops of JavaScript</title><link>http://www.whatalamp.com/js/loops-of-javascript/</link> <comments>http://www.whatalamp.com/js/loops-of-javascript/#comments</comments> <pubDate>Tue, 03 Apr 2007 18:52:06 +0000</pubDate> <dc:creator>David</dc:creator> <category><![CDATA[JavaScript]]></category> <category><![CDATA[loop]]></category><guid
isPermaLink="false">http://ref.g2soft.net/?p=76</guid> <description><![CDATA[Loops in JavaScript are used to execute the same block of code a specified number of times or while a specified condition is true. JavaScript Loops Very often when you write code, you want the same block of code to run over and over again in a row. Instead of adding several almost equal lines [...]]]></description> <content:encoded><![CDATA[<p>Loops in <a
href="http://www.whatalamp.com/tag/js/" class="st_tag internal_tag" rel="tag" title="Posts tagged with JavaScript">JavaScript</a> are used to execute the same block of <a
href="http://www.whatalamp.com/tag/code/" class="st_tag internal_tag" rel="tag" title="Posts tagged with code">code</a> a specified number of times or while a specified condition is true.</p><p>JavaScript Loops</p><p>Very often when you write code, you want the same block of code to run over and over again in a row. Instead of adding several almost equal lines in a script we can use loops to perform a task like this.</p><p>In JavaScript there are two different kind of loops:</p><p>* for &#8211; loops through a block of code a specified number of times<br
/> * while &#8211; loops through a block of code while a specified condition is true</p><p>The for <a
href="http://www.whatalamp.com/tag/loop/" class="st_tag internal_tag" rel="tag" title="Posts tagged with loop">Loop</a></p><p>The for loop is used when you know in advance how many times the script should run.</p><div
class="scode"> for (var=startvalue;var<=endvalue;var=var+increment)<br
/> {<br
/> code to be executed<br
/> }</div><p>The while loop</p><p>The while loop is used when you want the loop to execute and continue executing while the specified condition is true.</p><div
class="scode">while (var<=endvalue)<br
/> {<br
/> code to be executed<br
/> }</div><p>The do&#8230;while Loop</p><p>The do&#8230;while loop is a variant of the while loop. This loop will always execute a block of code ONCE, and then it will repeat the loop as long as the specified condition is true. This loop will always be executed at least once, even if the condition is false, because the code is executed before the condition is tested.</p><div
class="scode">do<br
/> {<br
/> code to be executed<br
/> }<br
/> while (var<=endvalue)</div><p>The above three loops are used very often while in JavaScript coding. Look at the difference of them carefully.</p>]]></content:encoded> <wfw:commentRss>http://www.whatalamp.com/js/loops-of-javascript/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Popup boxes</title><link>http://www.whatalamp.com/js/popup-boxes/</link> <comments>http://www.whatalamp.com/js/popup-boxes/#comments</comments> <pubDate>Thu, 29 Mar 2007 22:46:12 +0000</pubDate> <dc:creator>David</dc:creator> <category><![CDATA[JavaScript]]></category> <category><![CDATA[popup]]></category><guid
isPermaLink="false">http://ref.g2soft.net/?p=75</guid> <description><![CDATA[Popup boxes is used very often in Web developing. Alert Box An alert box is often used if you want to make sure information comes through to the user. When an alert box pops up, the user will have to click &#8220;OK&#8221; to proceed. Syntax: alert(&#8220;sometext&#8221;) Confirm Box A confirm box is often used if [...]]]></description> <content:encoded><![CDATA[<p><a
href="http://www.whatalamp.com/tag/popup/" class="st_tag internal_tag" rel="tag" title="Posts tagged with popup">Popup</a> boxes is used very often in Web developing.</p><p><strong>Alert Box</strong></p><p>An alert box is often used if you want to make sure information comes through to the user.</p><p>When an alert box pops up, the user will have to click &#8220;OK&#8221; to proceed.</p><p>Syntax:</p><div
class="scode">alert(&#8220;sometext&#8221;)</div><p><strong>Confirm Box</strong></p><p>A confirm box is often used if you want the user to verify or accept something.</p><p>When a confirm box pops up, the user will have to click either &#8220;OK&#8221; or &#8220;Cancel&#8221; to proceed.</p><p>If the user clicks &#8220;OK&#8221;, the box returns true. If the user clicks &#8220;Cancel&#8221;, the box returns false.</p><p>Syntax:</p><div
class="scode">confirm(&#8220;sometext&#8221;)</div><p><strong>Prompt Box</strong></p><p>A prompt box is often used if you want the user to input a value before entering a page.</p><p>When a prompt box pops up, the user will have to click either &#8220;OK&#8221; or &#8220;Cancel&#8221; to proceed after entering an input value.</p><p>If the user clicks &#8220;OK&#8221; the box returns the input value. If the user clicks &#8220;Cancel&#8221; the box returns null.</p><p>Syntax:</p><div
class="scode">prompt(&#8220;sometext&#8221;,&#8221;defaultvalue&#8221;)</div>]]></content:encoded> <wfw:commentRss>http://www.whatalamp.com/js/popup-boxes/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>JavaScript Version</title><link>http://www.whatalamp.com/js/javascript-version/</link> <comments>http://www.whatalamp.com/js/javascript-version/#comments</comments> <pubDate>Mon, 26 Mar 2007 06:28:30 +0000</pubDate> <dc:creator>David</dc:creator> <category><![CDATA[JavaScript]]></category> <category><![CDATA[version]]></category><guid
isPermaLink="false">http://ref.g2soft.net/?p=74</guid> <description><![CDATA[JavaScript from v1.1 to JavaScript 1.5. It is not big problem. Now, Javascript 1.5 is work smoothly on IE6.0 and Navigator 6.0. If you want to know which JavaScript version your browser support, you can download this html file and load it in your browser. Or you can run it by JavaScript Version Detector here. [...]]]></description> <content:encoded><![CDATA[<p><a
href="http://www.whatalamp.com/tag/js/" class="st_tag internal_tag" rel="tag" title="Posts tagged with JavaScript">JavaScript</a> from v1.1 to <a
href="http://www.whatalamp.com/tag/js/" class="st_tag internal_tag" rel="tag" title="Posts tagged with JavaScript">JavaScript</a> 1.5.</p><p>It is not big problem.<br
/> Now, Javascript 1.5 is work smoothly on IE6.0 and Navigator 6.0.</p><p>If you want to know which JavaScript <a
href="http://www.whatalamp.com/tag/version/" class="st_tag internal_tag" rel="tag" title="Posts tagged with version">version</a> your browser support, you can download this <a
href="http://www.whatalamp.com/tag/html/" class="st_tag internal_tag" rel="tag" title="Posts tagged with HTML">html</a> file and load it in your browser.</p><p>Or you can run it by <a
href="http://www.whatalamp.com/js/javascript-version/">JavaScript Version Detector</a><br
/> here.</p><p>The <a
href="http://www.whatalamp.com/tag/code/" class="st_tag internal_tag" rel="tag" title="Posts tagged with code">Code</a> is shown as below.</p><p><span
id="more-160"></span></p><div
class="scode"> &lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Transitional//EN&quot; &quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&quot;&gt;<br
/> &lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;<br
/> &lt;head&gt;<br
/> &lt;meta http-equiv=&quot;Content-<a
href="http://www.whatalamp.com/tag/type/" class="st_tag internal_tag" rel="tag" title="Posts tagged with type">Type</a>&quot; content=&quot;text/html; charset=utf-8&quot; /&gt;<br
/> &lt;title&gt;JavaScript Version : Self-Study Reference Centre&lt;/title&gt;<br
/> &lt;SCRIPT type=&quot;text/javascript&quot; LANGUAGE=&quot;JavaScript&quot;&gt;</p><p>&lt;!&#8211; This script and many more are available free online at &#8211;&gt;<br
/> &lt;!&#8211; The JavaScript Source!! http://www.whatalamp.com &#8211;&gt;</p><p>&lt;!&#8211; Begin<br
/> jsver = &quot;1.0&quot;;<br
/> // End &#8211;&gt;<br
/> &lt;/SCRIPT&gt;<br
/> &lt;SCRIPT type=&quot;text/javascript&quot; language=&quot;javascript1.1&quot;&gt;<br
/> &lt;!&#8211; Begin<br
/> jsver = &quot;1.1&quot;;<br
/> // End &#8211;&gt;<br
/> &lt;/SCRIPT&gt;<br
/> &lt;SCRIPT type=&quot;text/javascript&quot; Language=&quot;JavaScript1.2&quot; &gt;<br
/> &lt;!&#8211; Begin<br
/> jsver = &quot;1.2&quot;;<br
/> // End &#8211;&gt;<br
/> &lt;/SCRIPT&gt;<br
/> &lt;SCRIPT type=&quot;text/javascript&quot; Language=&quot;JavaScript1.3&quot;&gt;<br
/> &lt;!&#8211; Begin<br
/> jsver = &quot;1.3&quot;;<br
/> // End &#8211;&gt;<br
/> &lt;/SCRIPT&gt;<br
/> &lt;SCRIPT type=&quot;text/javascript&quot; Language=&quot;JavaScript1.4&quot; &gt;<br
/> &lt;!&#8211; Begin<br
/> jsver = &quot;1.4&quot;;<br
/> // End &#8211;&gt;<br
/> &lt;/SCRIPT&gt;<br
/> &lt;script type=&quot;text/javascript&quot; language=&quot;javascript1.5&quot;&gt;<br
/> &lt;!&#8211; Begin<br
/> jsver = &quot;1.5&quot;;<br
/> // End &#8211;&gt;<br
/> &lt;/SCRIPT&gt;</p><p>&lt;/head&gt;</p><p>&lt;body&gt;<br
/> &lt;NOSCRIPT&gt;<br
/> &lt;B&gt;Your browser does not currently support JavaScript.&lt;/B&gt;<br
/> &lt;P&gt;If your are using Netscape 2 or later then you can enable JavaScript. &lt;/P&gt;<br
/> &lt;P&gt;Version 2 or 3: Choose Options|Network Preferences, choose the Languages tab, click Enable Javascript and then click OK.&lt;/P&gt;<br
/> &lt;P&gt;Version 4: Choose Edit|Preferences|Advanced, click Enable JavaScript and then click OK.<br
/> &lt;HR /&gt;</p><p>With Internet Explorer 5:  Go to Tools Menu|Internet Options, Security Tab  and click on the Custom Level. Then select disable active scripting under the scripting section.<br
/> &lt;/NOSCRIPT&gt;<br
/> &lt;SCRIPT type=&quot;text/javascript&quot; LANGUAGE=&quot;JavaScript&quot;&gt;<br
/> &lt;!&#8211; Begin<br
/> document.write(&quot;&lt;B&gt;Your browser supports JavaScript version &quot; + jsver + &quot;.&lt;//b&gt;&quot;)<br
/> // End &#8211;&gt;<br
/> &lt;/SCRIPT&gt;</p><p>&lt;h2 align=&quot;center&quot;&gt;Free JavaScripts provided&lt;br/&gt;<br
/> by<br
/> &lt;a href=&quot;http://www.whatalamp.com/&quot;&gt;What a Lampe&lt;/a&gt; &lt;/h2&gt;</p><p>&lt;/body&gt;<br
/> &lt;/html&gt;</p></div>]]></content:encoded> <wfw:commentRss>http://www.whatalamp.com/js/javascript-version/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Date function in JavaScript</title><link>http://www.whatalamp.com/js/date-function-in-javascript/</link> <comments>http://www.whatalamp.com/js/date-function-in-javascript/#comments</comments> <pubDate>Tue, 20 Mar 2007 07:47:55 +0000</pubDate> <dc:creator>David</dc:creator> <category><![CDATA[JavaScript]]></category> <category><![CDATA[function]]></category><guid
isPermaLink="false">http://ref.g2soft.net/?p=73</guid> <description><![CDATA[Return today&#8217;s date and time How to use the Date() method to get today&#8217;s date. The following code line defines a Date object called myDate: var myDate=new Date() Note: The Date object will automatically hold the current date and time as its initial value! In the example below we set a Date object to a [...]]]></description> <content:encoded><![CDATA[<p>Return today&#8217;s date and time<br
/> How to use the Date() method to get today&#8217;s date.<br
/> The following <a
href="http://www.whatalamp.com/tag/code/" class="st_tag internal_tag" rel="tag" title="Posts tagged with code">code</a> line defines a Date object called myDate:</p><div
class="scode"> var myDate=new Date()</div><p>Note: The Date object will automatically hold the current date and time as its initial value!</p><p>In the example below we set a Date object to a specific date (14th January 2010):</p><div
class="scode"> var myDate=new Date()<br
/> myDate.setFullYear(2010,0,14)</div><p>And in the following example we set a Date object to be 5 days into the future:</p><div
class="scode"> var myDate=new Date()<br
/> myDate.setDate(myDate.getDate()+5)</div>]]></content:encoded> <wfw:commentRss>http://www.whatalamp.com/js/date-function-in-javascript/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Why use cookies</title><link>http://www.whatalamp.com/js/why-use-cookies/</link> <comments>http://www.whatalamp.com/js/why-use-cookies/#comments</comments> <pubDate>Sat, 17 Mar 2007 19:17:24 +0000</pubDate> <dc:creator>David</dc:creator> <category><![CDATA[JavaScript]]></category> <category><![CDATA[cookies]]></category><guid
isPermaLink="false">http://ref.g2soft.net/?p=72</guid> <description><![CDATA[Cookies allow you to store information about a user&#8217;s visit on that user&#8217;s computer and retrieve it when the userrevisits your site. Two common reasons web developers use cookies are To idetify visitors You can detect when a user has previously visited your site and customize what that user sees on subsequent visits. To save [...]]]></description> <content:encoded><![CDATA[<p><a
href="http://www.whatalamp.com/tag/cookies/" class="st_tag internal_tag" rel="tag" title="Posts tagged with cookies">Cookies</a> allow you to store information about a user&#8217;s visit on that user&#8217;s computer and retrieve it when the userrevisits your site.</p><p>Two common reasons web developers use cookies are</p><p><strong>To idetify visitors</strong><br
/> You can detect when a user has previously visited your site and customize what that user sees on subsequent visits.</p><p><strong>To save transaction state</strong><br
/> You can store the status of any lengthy transactions between your site and your visitors&#8217; browsers to safeguard against interruptions.</p><p>Here are some limits of cookies:<br
/> <em>Where cookies are placed:</em><br
/> The place is fixed, you can check it on your browser&#8217;s options.</p><p><em>How large cookie files can be:</em><br
/> 4K only.</p><p><em>how many cookies any given Website can place  on a user&#8217;s hard drive:</em><br
/> 20 cookies per site and set an overall total of 300 cookies per browser.</p><p><em>Which sites have access to cookies:</em><br
/> Cookie visibility is configurable.</p>]]></content:encoded> <wfw:commentRss>http://www.whatalamp.com/js/why-use-cookies/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Data types</title><link>http://www.whatalamp.com/js/data-types/</link> <comments>http://www.whatalamp.com/js/data-types/#comments</comments> <pubDate>Wed, 14 Mar 2007 19:28:52 +0000</pubDate> <dc:creator>David</dc:creator> <category><![CDATA[JavaScript]]></category> <category><![CDATA[type]]></category><guid
isPermaLink="false">http://ref.g2soft.net/?p=71</guid> <description><![CDATA[There are two data types that JavaScript requires you to explicitly specify: the Array and Data data types. JavaScript supports the following data types: Array An ordered collection. For example: var animals = new Array (&#8220;cat&#8221;, &#8220;dog&#8221;, &#8220;mouse&#8221;) Boolean True/false data type (values of true or false only). For example: var cookieDetected = false var [...]]]></description> <content:encoded><![CDATA[<p>There are two data types that <a
href="http://www.whatalamp.com/tag/js/" class="st_tag internal_tag" rel="tag" title="Posts tagged with JavaScript">JavaScript</a> requires you to explicitly specify: the <strong>Array</strong> and <strong>Data</strong> data types.</p><p>JavaScript supports the following data types:</p><p><strong>Array </strong> An ordered collection. For example:</p><div
class="scode">var animals = new Array (&#8220;cat&#8221;, &#8220;dog&#8221;, &#8220;mouse&#8221;)</div><p><strong>Boolean</strong> True/false data <a
href="http://www.whatalamp.com/tag/type/" class="st_tag internal_tag" rel="tag" title="Posts tagged with type">type</a> (values of true or false only). For example:</p><div
class="scode">var cookieDetected = false<br
/> var repeatVisitor = true</div><p><strong>Date</strong> Time and date data type. For example:</p><div
class="scode">var today = new Date() // current time/date via system clock<br
/> var newYearsDay = new Date(2007,01,01) //specific date</div><p><strong>null</strong> A special data type denoting nonexistence. For example:</p><div
class="scode"> if (emailAddress == null){ // check for null<br
/> alert(&#8220;please enter an e-mail address&#8221;)<br
/> }</div><p><em>Null is not the same as 0 (zero)</em></p><p><span
id="more-157"></span><br
/> <strong>Number </strong> Numerical data type. For example:</p><div
class="scode"> var numberHits = 1234 //implied numeric data type<br
/> var numberHits = new Number(1234) //explicit</div><p><strong>String</strong> String (text) data type. For example:</p><div
class="scode"> alert (&#8220;This is a string&#8221;)  // implied string with double quotes<br
/> alert (&#8216;So is this&#8217;)  // implied string with single quotes<br
/> var myString = new String(&#8220;Yet another string&#8221;)  // explicit</div>]]></content:encoded> <wfw:commentRss>http://www.whatalamp.com/js/data-types/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Make a Function</title><link>http://www.whatalamp.com/js/make-a-function/</link> <comments>http://www.whatalamp.com/js/make-a-function/#comments</comments> <pubDate>Tue, 13 Mar 2007 20:42:13 +0000</pubDate> <dc:creator>David</dc:creator> <category><![CDATA[JavaScript]]></category> <category><![CDATA[function]]></category><guid
isPermaLink="false">http://ref.g2soft.net/?p=70</guid> <description><![CDATA[A function is a named group of JavaScript statements that you can declare once, near the top of your script, and call over and over again. Declaring a function function name ([parameter] [, parameter] [..., paramenter]){ statements return value } Call a function alert(&#8220;Total purchases come to &#8221; + calculateTotal (10, 19.85)) Returning a value [...]]]></description> <content:encoded><![CDATA[<p>A <a
href="http://www.whatalamp.com/tag/function/" class="st_tag internal_tag" rel="tag" title="Posts tagged with function">function</a> is a named group of <a
href="http://www.whatalamp.com/tag/js/" class="st_tag internal_tag" rel="tag" title="Posts tagged with JavaScript">JavaScript</a> statements that you can declare once, near the top of your script, and call over and over again.</p><p><strong>Declaring a function</strong></p><div
class="scode"> function name ([parameter] [, parameter] [..., paramenter]){<br
/> statements<br
/> return value<br
/> }</div><p><strong>Call a function</strong></p><div
class="scode">alert(&#8220;Total purchases come to &#8221; + calculateTotal (10, 19.85))</div><p><strong>Returning a value from a function<br
/> </strong></p><div
class="scode"> function calculateTotal (numberOrdered, itemPrice){<br
/> var totalPrice = (numberOrdered * itemPrice) + salesTax<br
/> return totalPrice<br
/> }</div><p>The call function above will not get the result without the returning value.</p>]]></content:encoded> <wfw:commentRss>http://www.whatalamp.com/js/make-a-function/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced (User agent is rejected)
Database Caching 38/84 queries in 1.131 seconds using disk: basic

Served from: www.whatalamp.com @ 2012-02-08 02:57:19 -->
