<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-3989757413190406423</id><updated>2011-11-27T15:43:01.320-08:00</updated><title type='text'>Learn Java Script</title><subtitle type='html'>This tutorial will help you to learn the basics of JavaScript and write your own JavaScript codes</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://lectures-javascript.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3989757413190406423/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://lectures-javascript.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Malik</name><uri>http://www.blogger.com/profile/11760057276874241659</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>17</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-3989757413190406423.post-2450718406556632615</id><published>2009-04-30T01:04:00.001-07:00</published><updated>2010-04-15T00:23:00.639-07:00</updated><title type='text'>Introduction</title><content type='html'>&lt;script type="text/javascript"&gt;google_ad_client = "pub-1854160677420698";google_ad_slot = "3354353093";google_ad_width = 336;google_ad_height = 280;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;font face="Times New Roman" size="3"&gt;JavaScript is a scripting language widely used for client-side web development. It  was the originating dialect of the ECMAScript standard. It is a  dynamic, weakly typed, prototype-based language with first-class  functions. JavaScript was influenced by many languages and was designed  to look like Java, but be easier for non-programmers to work with.&lt;br /&gt;&lt;br /&gt;"JavaScript" is a trademark of Sun Microsystems. It was used under  license for technology invented and implemented by Netscape  Communications and current entities such as the Mozilla Foundation.&lt;br /&gt;&lt;br /&gt;Although best known for its use in websites (as client-side  JavaScript), JavaScript is also used to enable scripting access to  objects embedded in other applications (see below).&lt;br /&gt;&lt;br /&gt;JavaScript, despite the name,  is essentially unrelated to the Java programming language, although  both have the common C syntax, and JavaScript copies many Java names  and naming conventions. The language's name is the result of a  co-marketing deal between Netscape and Sun, in exchange for Netscape  bundling Sun's Java runtime with their then-dominant browser. The key  design principles within JavaScript are inherited from the self and  Scheme programming languages.&lt;strong&gt;&lt;br /&gt;&lt;br /&gt;What's the difference between JavaScript and Java?&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Actually, the 2 languages have almost nothing in common except for the  name. Although Java is technically an interpreted programming language,  it is coded in a similar fashion to C++, with separate header and class  files, compiled together prior to execution. It is powerfull enough to write major applications  and insert them in a web page as a special object called an "applet."  Java has been generating a lot of excitement because of its unique ability to  run the same program on IBM, Mac, and UNIX computers. Java is not considered an  easy-to-use language for non-programmers.&lt;br /&gt;&lt;br /&gt;JavaScript is much simpler to use than Java. With JavaScript, if I want  check a form for errors; I just type an if-then statement at the top of my  page. No compiling, no applets, just a simple sequence.&lt;/font&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3989757413190406423-2450718406556632615?l=lectures-javascript.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3989757413190406423/posts/default/2450718406556632615'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3989757413190406423/posts/default/2450718406556632615'/><link rel='alternate' type='text/html' href='http://lectures-javascript.blogspot.com/2009/04/introduction.html' title='Introduction'/><author><name>Malik</name><uri>http://www.blogger.com/profile/11760057276874241659</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3989757413190406423.post-7668233591864297298</id><published>2009-04-30T01:02:00.001-07:00</published><updated>2010-04-15T00:24:18.053-07:00</updated><title type='text'>Object Oriented Programming</title><content type='html'>&lt;script type="text/javascript"&gt;google_ad_client = "pub-1854160677420698";google_ad_slot = "3354353093";google_ad_width = 336;google_ad_height = 280;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;What is Object Oriented Programming?&lt;/strong&gt;&lt;br /&gt;Everyone that wants to program JavaScript should at least try reading the following section. If you have trouble  understanding it, don't worry. The best way to learn JavaScript is from  the examples presented in this tutorial. After you have been through  the lessons, come back to this page and read it again.&lt;br /&gt;&lt;br /&gt; OOP is a programming technique (note: not a language structure - you  don't even need an object-oriented language to program in an  object-oriented fashion) designed to simplify complicated programming  concepts. In essence, object-oriented programming revolves around the  idea of user- and system-defined chunks of data, and controlled means  of accessing and modifying those chunks.&lt;br /&gt;&lt;br /&gt; Object-oriented programming consists of Objects, Methods and Properties. An &lt;em&gt;object&lt;/em&gt; is basically  a black box which stores some information.  It may have a way for you to read that information and a way for you to  write to, or change, that information. It may also have other less  obvious ways of interacting with the information.&lt;br /&gt;&lt;br /&gt; Some of the information in the object may actually be directly accessible;  other information may require you to use a &lt;em&gt;method&lt;/em&gt; to access it - perhaps because the way the information is stored  internally is of no use to you, or because only certain things can be  written into that information space and the object needs to check that  you're not going outside those limits.&lt;br /&gt;&lt;br /&gt; The directly accessible bits of information in the object are its &lt;em&gt;properties&lt;/em&gt;.  The difference between data accessed via properties and data accessed  via methods is that with properties, you see exactly what you're doing  to the object; with methods, unless you created the object yourself, you just see the effects of  what you're doing.&lt;br /&gt;&lt;br /&gt; Other JavaScript pages you read will probably refer frequently to  objects, events, methods, and properties. This tutorial will teach by  example, without focusing too heavily on OOP vocabulary. However, you  will need a basic understanding of these terms to use other JavaScript  references.&lt;br /&gt;&lt;br /&gt; &lt;strong&gt;Objects and Properties&lt;/strong&gt;&lt;br /&gt;Your web page document is an object. Any table, form,  button, image, or link on your page is also an object. Each object has  certain properties (information about the object). For example, the  background color of your document is written document.bgcolor. You  would change the color of your page to red by writing the line:  document.bgcolor="red"&lt;br /&gt;&lt;br /&gt; The contents (or value) of a textbox named "password" in a form  named "entryform" is document.entryform.password.value. &lt;strong&gt;&lt;br /&gt;&lt;br /&gt;   Methods&lt;/strong&gt;&lt;br /&gt;Most objects have a certain collection of things that they can do.  Different objects can do different things, just as a door can open and  close, while a light can turn on and off. A new document is opened with  the method document.open() You can write "Hello World" into a document  by typing document.write("Hello World") . open() and write() are both  methods of the object: document. &lt;strong&gt;&lt;br /&gt;&lt;br /&gt;   Events&lt;/strong&gt;&lt;br /&gt;Events are how we trigger our functions to run. The easiest example is  a button, whose definition includes the words  onClick="run_my_function()". The onClick event, as its name implies, will run the function when the user clicks on the button.  Other events include OnMouseOver, OnMouseOut, OnFocus, OnBlur, OnLoad,  and OnUnload.&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3989757413190406423-7668233591864297298?l=lectures-javascript.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3989757413190406423/posts/default/7668233591864297298'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3989757413190406423/posts/default/7668233591864297298'/><link rel='alternate' type='text/html' href='http://lectures-javascript.blogspot.com/2009/04/object-oriented-programming.html' title='Object Oriented Programming'/><author><name>Malik</name><uri>http://www.blogger.com/profile/11760057276874241659</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3989757413190406423.post-5625111676081797334</id><published>2009-04-30T00:46:00.001-07:00</published><updated>2010-04-15T00:24:30.846-07:00</updated><title type='text'>How to</title><content type='html'>&lt;script type="text/javascript"&gt;google_ad_client = "pub-1854160677420698";google_ad_slot = "3354353093";google_ad_width = 336;google_ad_height = 280;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;font face="Times New Roman" size="3"&gt;The HTML &amp;lt;script&amp;gt; tag is used to insert a JavaScript into an HTML page.&lt;br /&gt;&lt;strong&gt;How to Put a JavaScript Into an HTML Page&lt;/strong&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;script  type="text/javascript"&amp;gt;&lt;br /&gt;document.write("Hello World!");&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;p&gt;The code above will produce this output on an HTML page:&lt;/p&gt;&lt;p&gt;Hello World! &lt;/p&gt;&lt;p&gt;To  insert a JavaScript into an HTML page, we use the &amp;lt;script&amp;gt; tag.  Inside the &amp;lt;script&amp;gt; tag we use the type attribute to define the  scripting language.&lt;br /&gt;&lt;br /&gt;So, the &amp;lt;script type="text/javascript"&amp;gt; and  &amp;lt;/script&amp;gt; tells where the JavaScript starts and ends:&lt;/p&gt;&lt;p&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;script  type="text/javascript"&amp;gt;&lt;br /&gt;...&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/p&gt;&lt;p&gt;The word document.write  is a standard JavaScript command for writing output to a page.&lt;br /&gt;&lt;br /&gt;By entring the document.write command between the &amp;lt;script&amp;gt; and  &amp;lt;/script&amp;gt; tags, the browser will recognize it as a JavaScript  command and execute the code line. In this case the browser will write  Hello World! to the page:&lt;/p&gt;&lt;p&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;script  type="text/javascript"&amp;gt;&lt;br /&gt;document.write("Hello World!");&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;HTML Comments to  Handle Simple Browsers&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;Browsers that do not support JavaScript will display  JavaScript as page content.&lt;br /&gt;To prevent them from doing this, and as a part of the JavaScript  standard, the HTML comment tag can be used to "hide" the JavaScript.  Just add an HTML comment tag &amp;lt;!-- before the first JavaScript  statement, and a --&amp;gt; (end of comment) after the last JavaScript statement.&lt;/p&gt;&lt;p&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;script  type="text/javascript"&amp;gt;&lt;br /&gt;&amp;lt;!--&lt;br /&gt;document.write("Hello World!");&lt;br /&gt;//--&amp;gt;&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/p&gt;&lt;p&gt;The  two forward slashes at the end of comment line (//) is the JavaScript  comment symbol. This prevents JavaScript from executing the --&amp;gt; tag.&lt;/p&gt;&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3989757413190406423-5625111676081797334?l=lectures-javascript.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3989757413190406423/posts/default/5625111676081797334'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3989757413190406423/posts/default/5625111676081797334'/><link rel='alternate' type='text/html' href='http://lectures-javascript.blogspot.com/2009/04/how-to.html' title='How to'/><author><name>Malik</name><uri>http://www.blogger.com/profile/11760057276874241659</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3989757413190406423.post-8798818834482883474</id><published>2009-04-30T00:43:00.001-07:00</published><updated>2010-04-15T00:24:43.970-07:00</updated><title type='text'>Where use JavaScript</title><content type='html'>&lt;script type="text/javascript"&gt;google_ad_client = "pub-1854160677420698";google_ad_slot = "3354353093";google_ad_width = 336;google_ad_height = 280;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;Where should I put  JavaScript?&lt;/strong&gt;&lt;br /&gt;It depends. You have three choices. Since a web page can  have multiple scripts, you can use them all on the same page! Scripts can be in the  &amp;lt;head&amp;gt; section, the &amp;lt;body&amp;gt; section, or an external file.&lt;br /&gt;&lt;br /&gt; Scripts in the &amp;lt;head&amp;gt; section are loaded first, before the rest  of the web page is loaded. Scripts in the &amp;lt;body&amp;gt; section are  loaded at their position on the web page.&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Are scripts executed  automatically?&lt;/strong&gt;&lt;br /&gt;Not all scripts are executed automatically. Scripts with functions are not executed until they are called. You will learn that a script  can be called when it is triggered by an event. One such event is clicking a  button.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;What is an external  script?&lt;/strong&gt;&lt;br /&gt;An external script is saved in a separate file, like an external style  sheet. By convention, the filename with javaScript scripts ends with  .js (for JavaScript, naturally).&lt;/p&gt;&lt;p&gt;&lt;strong&gt;How do I use an  external script?&lt;/strong&gt;&lt;br /&gt;In the &amp;lt;script&amp;gt; tag, add the src attribute to identify  the location of the JavaScript file; for example:&lt;br /&gt;&lt;br /&gt; &amp;lt;script src="global.js"&amp;gt;&amp;lt;/script&amp;gt;&lt;/p&gt;&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3989757413190406423-8798818834482883474?l=lectures-javascript.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3989757413190406423/posts/default/8798818834482883474'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3989757413190406423/posts/default/8798818834482883474'/><link rel='alternate' type='text/html' href='http://lectures-javascript.blogspot.com/2009/04/where-use-javascript.html' title='Where use JavaScript'/><author><name>Malik</name><uri>http://www.blogger.com/profile/11760057276874241659</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3989757413190406423.post-4798420725969828583</id><published>2009-04-30T00:36:00.000-07:00</published><updated>2010-04-15T00:24:53.785-07:00</updated><title type='text'>Variables</title><content type='html'>&lt;script type="text/javascript"&gt;google_ad_client = "pub-1854160677420698";google_ad_slot = "3354353093";google_ad_width = 336;google_ad_height = 280;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;JavaScript Variables&lt;/strong&gt;&lt;br /&gt;As with algebra, JavaScript variables are used to hold  values or expressions.&lt;br /&gt;A variable can have a short name, like x, or a more descriptive  name, like carname.&lt;br /&gt;Rules for JavaScript variable names:&lt;ul&gt;&lt;li&gt;Variable       names are case sensitive (y and Y are two different variables)&lt;/li&gt;  &lt;li&gt;Variable       names must begin with a letter or the underscore character&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;strong&gt;Note:&lt;/strong&gt; Because JavaScript is case-sensitive,  variable names are case-sensitive.&lt;/p&gt;&lt;p&gt;A variable is a place holder in your computer's memory for information that can change.  This place in memory is given a name in JavaScript so  that you can easily refer to it. Declaring a variable is easy.  All you  have to do is precede the variable name with the JavaScript reserved  word var as follows: &lt;/p&gt;&lt;p&gt;var myVariable &lt;/p&gt;&lt;p&gt;Once the variable is declared, you can set it to any one of  the values shown in the above table. Here is an &lt;span style="font-weight: bold;"&gt;example:&lt;/span&gt;&lt;br /&gt;myVariable = 5 &lt;/p&gt;&lt;p&gt;Later on in the program you can change its value to  something different: &lt;/p&gt;&lt;p&gt;myVariable = 33 &lt;/p&gt;&lt;p&gt;You  can even change its type by simply assigning it a different type of  value. For instance our variable was originally assigned a number. We  can make it a string later in the program by simply assigning it one  as follows: &lt;/p&gt;&lt;p&gt;myVariable = "this is a string" &lt;/p&gt;&lt;p&gt;Note  that the variables in some other languages, such a C, are strongly  typed and you are not allowed to randomly change the variable's type as  we did here.&lt;br /&gt;&lt;br /&gt;You can initialize a variable and assign it a value at the same time as  follows: &lt;/p&gt;&lt;p&gt;var myVariable = "JavaScript is cool" &lt;/p&gt;&lt;p&gt;This is method that you will probably use most of the time  to declare and initialize your variables.&lt;br /&gt;You can even leave out the var keyword as follows: &lt;/p&gt;&lt;p&gt;myVariable = "this is not too cool" &lt;/p&gt;&lt;p&gt;You will note that the variable name myVariable contains two  words with the first letter of the second word capitalized. It is common practice in JavaScript to use small  letters for variable names and to capitalize the first letter of every  new word starting with the second word.  Also note that there is no space between the two words. &lt;/p&gt;&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3989757413190406423-4798420725969828583?l=lectures-javascript.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3989757413190406423/posts/default/4798420725969828583'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3989757413190406423/posts/default/4798420725969828583'/><link rel='alternate' type='text/html' href='http://lectures-javascript.blogspot.com/2009/04/variables.html' title='Variables'/><author><name>Malik</name><uri>http://www.blogger.com/profile/11760057276874241659</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3989757413190406423.post-5588163211876842769</id><published>2009-04-30T00:27:00.000-07:00</published><updated>2010-04-15T00:25:04.521-07:00</updated><title type='text'>Operators</title><content type='html'>&lt;script type="text/javascript"&gt;google_ad_client = "pub-1854160677420698";google_ad_slot = "3354353093";google_ad_width = 336;google_ad_height = 280;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;font face="Times New Roman" size="3"&gt;Operators are symbols that are used with variables to allow  us to perform certain functions, such as adding, subtracting and etc. The table  below lists the operators available in JavaScript and describes its function  (assuming the two variables x and y that have been declared and initialized  with a value)&lt;br /&gt;&lt;p&gt;&lt;strong&gt;JavaScript Arithmetic  Operators&lt;/strong&gt;&lt;br /&gt;Arithmetic operators are used to perform arithmetic between  variables and/or values.&lt;br /&gt;Given that y=5, the table below explains the arithmetic  operators:&lt;/p&gt;&lt;table width="404" border="1" cellpadding="0" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr&gt;     &lt;td width="14%"&gt;&lt;strong&gt;Operator&lt;/strong&gt; &lt;/td&gt;&lt;td width="45%"&gt;&lt;p&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td width="22%"&gt;&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td width="17%"&gt;&lt;p&gt;&lt;strong&gt;Result&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;     &lt;td valign="top"&gt;&lt;p&gt;+&lt;/p&gt;&lt;/td&gt;&lt;td valign="top" width="45%"&gt;&lt;p&gt;Addition &lt;/p&gt;&lt;/td&gt;&lt;td valign="top" width="22%"&gt;&lt;p&gt;x=y+2 &lt;/p&gt;&lt;/td&gt;&lt;td valign="top" width="17%"&gt;&lt;p&gt;x=7 &lt;/p&gt;&lt;/td&gt;  &lt;/tr&gt;   &lt;tr&gt;     &lt;td valign="top"&gt;&lt;p&gt;-&lt;/p&gt;&lt;/td&gt;&lt;br /&gt;&lt;td valign="top" width="45%"&gt;&lt;p&gt;Subtraction &lt;/p&gt;&lt;/td&gt;   &lt;td valign="top" width="22%"&gt;&lt;p&gt;x=y-2&lt;/p&gt;&lt;/td&gt;   &lt;td valign="top" width="17%"&gt;&lt;p&gt;x=3&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;     &lt;td valign="top"&gt;&lt;p&gt;*&lt;/p&gt;&lt;/td&gt;    &lt;td valign="top" width="45%"&gt;&lt;p&gt;Multiplication &lt;/p&gt;&lt;/td&gt;&lt;td valign="top" width="22%"&gt;&lt;p&gt;x=y*2&lt;/p&gt;&lt;/td&gt;     &lt;td valign="top" width="17%"&gt;&lt;p&gt;x=10&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt; &lt;td valign="top"&gt;&lt;p&gt;/&lt;/p&gt;&lt;/td&gt;  &lt;td valign="top" width="45%"&gt;&lt;p&gt;Division &lt;/p&gt;&lt;br /&gt;&lt;/td&gt;&lt;td valign="top" width="22%"&gt;&lt;p&gt;x=y/2&lt;/p&gt;&lt;/td&gt; &lt;td valign="top" width="17%"&gt;&lt;p&gt;x=2.5&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;     &lt;td valign="top"&gt;&lt;p&gt;%&lt;/p&gt;&lt;/td&gt;&lt;td valign="top" width="45%"&gt;&lt;p&gt;Modulus (division remainder) &lt;/p&gt;&lt;/td&gt;     &lt;td valign="top" width="22%"&gt;&lt;p&gt;x=y%2&lt;/p&gt;&lt;/td&gt;    &lt;td valign="top" width="17%"&gt;&lt;p&gt;x=1&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;     &lt;td valign="top"&gt;&lt;p&gt;++&lt;/p&gt;&lt;/td&gt;    &lt;td valign="top" width="45%"&gt;&lt;p&gt;Increment&lt;/p&gt;&lt;/td&gt;    &lt;td valign="top" width="22%"&gt;&lt;p&gt;x=++y&lt;/p&gt;&lt;/td&gt;    &lt;td valign="top" width="17%"&gt;&lt;p&gt;x=6 &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;  &lt;tr&gt;  &lt;td valign="top"&gt;&lt;p&gt;--&lt;/p&gt;&lt;/td&gt;    &lt;td valign="top" width="45%"&gt;&lt;p&gt;Decrement&lt;/p&gt;&lt;/td&gt;&lt;td valign="top" width="22%"&gt;&lt;p&gt;x=--y&lt;/p&gt;&lt;/td&gt;&lt;td valign="top" width="17%"&gt;&lt;p&gt;x=4 &lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;JavaScript Assignment  Operators&lt;/strong&gt;&lt;br /&gt;Assignment operators are used to assign values to JavaScript  variables.&lt;br /&gt;Given that x=10 and y=5, the table below explains the assignment  operators:&lt;/p&gt;&lt;table width="404" border="1" cellpadding="0" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr&gt;     &lt;td width="15%"&gt;&lt;strong&gt;Operator&lt;/strong&gt; &lt;/td&gt;&lt;td width="40%"&gt;&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td width="25%"&gt;&lt;p&gt;&lt;strong&gt;Same As&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td width="20%"&gt;&lt;p&gt;&lt;strong&gt;Result&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;     &lt;td valign="top"&gt;&lt;p&gt;=&lt;/p&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;p&gt;x=y&lt;/p&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;p&gt; &lt;/p&gt;&lt;br /&gt;&lt;/td&gt;     &lt;td valign="top"&gt;&lt;p&gt;x=5&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;     &lt;td valign="top"&gt;&lt;p&gt;+=&lt;/p&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;p&gt;x+=y&lt;/p&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;p&gt;x=x+y&lt;/p&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;p&gt;x=15&lt;/p&gt;&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt; &lt;br /&gt;&lt;td valign="top"&gt;&lt;p&gt;-=&lt;/p&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;p&gt;x-=y&lt;/p&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;p&gt;x=x-y&lt;/p&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;p&gt;x=5&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt;   &lt;tr&gt;     &lt;td valign="top"&gt;&lt;p&gt;*=&lt;/p&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;p&gt;x*=y&lt;/p&gt;&lt;/td&gt;     &lt;td valign="top"&gt;&lt;p&gt;x=x*y&lt;/p&gt;&lt;/td&gt;     &lt;td valign="top"&gt;&lt;p&gt;x=50&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;&lt;p&gt;/=&lt;/p&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;p&gt;x/=y&lt;/p&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;p&gt;x=x/y&lt;/p&gt;&lt;/td&gt;     &lt;td valign="top"&gt;&lt;p&gt;x=2&lt;/p&gt;&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td valign="top"&gt;&lt;p&gt;%=&lt;/p&gt;&lt;/td&gt;     &lt;td valign="top"&gt;&lt;p&gt;x%=y&lt;/p&gt;&lt;/td&gt;&lt;br /&gt;&lt;td valign="top"&gt;&lt;p&gt;x=x%y&lt;/p&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;p&gt;x=0&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Comparison Operators&lt;/strong&gt;&lt;br /&gt;Comparison operators are used in logical statements to  determine equality or difference between variables or values.&lt;br /&gt;Given that x=5, the table below explains the comparison  operators:&lt;/p&gt;&lt;table width="404" border="1" cellpadding="0" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr&gt;     &lt;td width="14%"&gt;&lt;strong&gt;Operator&lt;/strong&gt; &lt;/td&gt;&lt;td width="44%"&gt;&lt;p&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;&lt;td width="40%"&gt;&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;   &lt;/tr&gt;&lt;tr&gt;     &lt;td valign="top"&gt;&lt;p&gt;==&lt;/p&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;p&gt;is equal to &lt;/p&gt;&lt;/td&gt;&lt;td valign="top" width="40%"&gt;&lt;p&gt;x==8 is false &lt;/p&gt;&lt;/td&gt;   &lt;/tr&gt;&lt;tr&gt;&lt;td valign="top"&gt;&lt;p&gt;===&lt;/p&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;p&gt;is exactly equal to (value and type)&lt;/p&gt;&lt;/td&gt;&lt;td valign="top" width="40%"&gt;&lt;p&gt;x===5 is true&lt;br /&gt;x==="5" is false&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;     &lt;td valign="top"&gt;&lt;p&gt;!=&lt;/p&gt;&lt;/td&gt;     &lt;td valign="top"&gt;&lt;p&gt;is not equal &lt;/p&gt;&lt;/td&gt;&lt;td valign="top" width="40%"&gt;&lt;p&gt;x!=8 is true &lt;/p&gt;&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td valign="top"&gt;&lt;p&gt;&amp;gt; &lt;/p&gt;&lt;/td&gt;   &lt;td valign="top"&gt;&lt;p&gt;is greater than &lt;/p&gt;&lt;/td&gt;&lt;td valign="top" width="40%"&gt;&lt;p&gt;x&amp;gt;8 is false &lt;/p&gt;&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td valign="top"&gt;&lt;p&gt;&amp;lt; &lt;/p&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;p&gt;is less than &lt;/p&gt;&lt;/td&gt;&lt;td valign="top" width="40%"&gt;&lt;p&gt;x&amp;lt;8 is true&lt;/p&gt;&lt;/td&gt;   &lt;/tr&gt;  &lt;tr&gt;     &lt;td valign="top"&gt;&lt;p&gt;&amp;gt;=&lt;/p&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;p&gt;is greater than or equal to &lt;/p&gt;&lt;/td&gt;     &lt;td valign="top" width="40%"&gt;&lt;p&gt;x&amp;gt;=8 is false&lt;/p&gt;&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td valign="top"&gt;&lt;p&gt;&amp;lt;=&lt;/p&gt;&lt;/td&gt;     &lt;td valign="top"&gt;&lt;p&gt;is less than or equal to &lt;/p&gt;&lt;/td&gt;&lt;td valign="top" width="40%"&gt;&lt;p&gt;x&amp;lt;=8 is true&lt;/p&gt;&lt;/td&gt;   &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Logical Operators&lt;/strong&gt;&lt;br /&gt;Logical operators are used to determine the logic between  variables or values.&lt;br /&gt;Given that x=6 and y=3, the table below explains the logical  operators: &lt;/p&gt;&lt;table width="404" border="1" cellpadding="0" cellspacing="0"&gt;  &lt;tbody&gt;&lt;tr&gt;     &lt;td width="15%"&gt;&lt;strong&gt;Operator&lt;/strong&gt; &lt;/td&gt;&lt;td width="45%"&gt;&lt;p&gt;&lt;strong&gt;Description&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt;     &lt;td width="40%"&gt;&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt;   &lt;tr&gt;     &lt;td valign="top"&gt;&lt;p&gt;&amp;amp;&amp;amp;&lt;/p&gt;&lt;/td&gt;     &lt;td valign="top"&gt;&lt;p&gt;and &lt;/p&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;p&gt;(x &amp;lt; 10 &amp;amp;&amp;amp; y &amp;gt; 1) is true&lt;/p&gt;&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td valign="top"&gt;&lt;p&gt;||&lt;/p&gt;&lt;/td&gt;     &lt;td valign="top"&gt;&lt;p&gt;or &lt;/p&gt;&lt;/td&gt;&lt;td valign="top"&gt;&lt;p&gt;(x==5 || y==5) is false&lt;/p&gt;&lt;/td&gt;   &lt;/tr&gt;   &lt;tr&gt;     &lt;td valign="top"&gt;&lt;p&gt;!&lt;/p&gt;&lt;/td&gt;     &lt;td valign="top"&gt;&lt;p&gt;not &lt;/p&gt;&lt;/td&gt;     &lt;td valign="top"&gt;&lt;p&gt;!(x==y) is true&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/font&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3989757413190406423-5588163211876842769?l=lectures-javascript.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3989757413190406423/posts/default/5588163211876842769'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3989757413190406423/posts/default/5588163211876842769'/><link rel='alternate' type='text/html' href='http://lectures-javascript.blogspot.com/2009/04/operators.html' title='Operators'/><author><name>Malik</name><uri>http://www.blogger.com/profile/11760057276874241659</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3989757413190406423.post-1191729825239979287</id><published>2009-04-29T23:44:00.002-07:00</published><updated>2010-04-15T00:25:22.188-07:00</updated><title type='text'>if Statement</title><content type='html'>&lt;script type="text/javascript"&gt;google_ad_client = "pub-1854160677420698";google_ad_slot = "3354353093";google_ad_width = 336;google_ad_height = 280;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;font face="Times New Roman" size="3"&gt;The if statement is used to make decisions in JavaScript.  Boolean operators are also discussed in this lesson because they are used in  along with if statement.&lt;br /&gt;&lt;p&gt;&lt;strong&gt;if Statement &lt;/strong&gt;&lt;br /&gt;The if statement is one of the most used features of JavaScript. It is basically the same in JavaScript as it is in other  programming languages. If you are new to programming, you should spend  some time understanding how the if statement works.&lt;br /&gt;&lt;br /&gt; You use the if statement in JavaScript to make decisions.  The syntax for it is as follows: &lt;/p&gt;&lt;p&gt; if (condition){&lt;br /&gt;   statements&lt;br /&gt;   }&lt;/p&gt;&lt;p&gt;if  keyword identifies this as an if statement. The condition in the  parenthesis ( ) is evaluated to determine if true, and if so then the  statements inside the curly braces { } are executed, otherwise they are skipped and the programs continues with the first line after if statement. &lt;/p&gt;&lt;p&gt;An optional else statement can be included with if statement  as follows: &lt;/p&gt;&lt;p&gt; if (condition){&lt;br /&gt;   statements&lt;br /&gt;   }&lt;br /&gt; else{&lt;br /&gt;   statements&lt;br /&gt;   }   &lt;/p&gt;&lt;p&gt;In  this case, the statements inside of curly brackets { } after the else  keyword are executed if the condition of if statement is false.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;  Boolean Operators &lt;/span&gt;&lt;br /&gt;Suppose you wanted the previous script to display a letter grade  instead of passed/failed. You would want to display A for a 90 or  above, B for a grade 80 or above but less than 90 and ETC. To determine  a B you could nest if statements as shown below. This can get real  messy and require a lot of code. &lt;/p&gt;&lt;p&gt;if (grade &amp;lt; 90){&lt;br /&gt;  if (grade &amp;gt;= 80){&lt;br /&gt;     document.write('You got a "B"')&lt;br /&gt;    }&lt;br /&gt;  }&lt;br /&gt;&lt;br /&gt; A better way is to use the and operator, &amp;amp;&amp;amp;. Here is  a rewrite of the script using the and operator. &lt;/p&gt;&lt;p&gt;if (grade &amp;lt; 90 &amp;amp;&amp;amp; grade &amp;gt;= 80){&lt;br /&gt;   document.write('Grade is a "B"')&lt;br /&gt;  }&lt;/p&gt;&lt;p&gt;The  and operator, &amp;amp;&amp;amp; , allows you to combine two conditions so that  both must be true to satisfy the if condition. Another Boolean operator  is the or operator, ||, which combines two conditions such that the if  statement is satisfied if either condition is true. The third boolean  operator is the Not Operator, !, which makes a condition that returns  true, false and vice versa. &lt;/p&gt;&lt;p&gt;Look  again at the above script and notice that phrase 'Grade is a "B"'  contains both double quotes and single quotes. This is the way you can  put quotes inside of quotes in JavaScript. &lt;/p&gt;&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3989757413190406423-1191729825239979287?l=lectures-javascript.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3989757413190406423/posts/default/1191729825239979287'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3989757413190406423/posts/default/1191729825239979287'/><link rel='alternate' type='text/html' href='http://lectures-javascript.blogspot.com/2009/04/if-statement.html' title='if Statement'/><author><name>Malik</name><uri>http://www.blogger.com/profile/11760057276874241659</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3989757413190406423.post-7088330024518558471</id><published>2009-04-29T23:44:00.001-07:00</published><updated>2010-04-15T00:25:31.657-07:00</updated><title type='text'>Switch Statement</title><content type='html'>&lt;script type="text/javascript"&gt;google_ad_client = "pub-1854160677420698";google_ad_slot = "3354353093";google_ad_width = 336;google_ad_height = 280;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;The switch statement  of JavaScript &lt;/strong&gt;&lt;br /&gt;The switch statement is basically an enhanced version of the  "if-else" statement that is more convenient to use when you have code  that needs to choose a path from many to follow. Let's have a look at this  statement's general syntax:&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Syntax:&lt;/strong&gt;&lt;br /&gt;switch (expression){&lt;br /&gt;case value1:&lt;br /&gt;statement;&lt;br /&gt;break;&lt;br /&gt;case value2:&lt;br /&gt;statement;&lt;br /&gt;break;&lt;br /&gt;"&lt;br /&gt;"&lt;br /&gt;default : statement;&lt;br /&gt;}&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br /&gt;switch (favoritemovie){&lt;br /&gt;case "Titanic":&lt;br /&gt;alert("Not a bad choice!")&lt;br /&gt;break;&lt;br /&gt;case "Water World":&lt;br /&gt;alert("No comment")&lt;br /&gt;break;&lt;br /&gt;case "Scream 2":&lt;br /&gt;alert("It has its moments")&lt;br /&gt;break;&lt;br /&gt;default : alert("I\'m sure it was great");&lt;br /&gt;}&lt;/p&gt;&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3989757413190406423-7088330024518558471?l=lectures-javascript.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3989757413190406423/posts/default/7088330024518558471'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3989757413190406423/posts/default/7088330024518558471'/><link rel='alternate' type='text/html' href='http://lectures-javascript.blogspot.com/2009/04/switch-statement.html' title='Switch Statement'/><author><name>Malik</name><uri>http://www.blogger.com/profile/11760057276874241659</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3989757413190406423.post-7371551153465614071</id><published>2009-04-29T23:41:00.001-07:00</published><updated>2010-04-15T00:25:40.833-07:00</updated><title type='text'>Functions</title><content type='html'>&lt;script type="text/javascript"&gt;google_ad_client = "pub-1854160677420698";google_ad_slot = "3354353093";google_ad_width = 336;google_ad_height = 280;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;font face="Times New Roman" size="3"&gt;A function contains code that  will be executed by an event or by a call to that function. You can  however use a function to contain the script and call it every time your need it. Here is the syntax for a function.&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Syntax:&lt;/strong&gt;&lt;br /&gt; function name (parameters){&lt;br /&gt;   statements&lt;br /&gt;   }&lt;br /&gt;&lt;br /&gt; The function keyword identifies this as a function. The  parameters in the parenthesis ( ) provide a means of passing values to the function. There can be as many  parameters separated by commas as you need. It is perfectly ok to have  a function with no parameters. These parameters are variables which are  used by the JavaScript statements inside the curly braces { }. The var keyword is not needed  to declare the parameters in a function as variables because they are automatically declared and initialized when the  function is called. The function can return a value by using the return  keyword. &lt;/p&gt;&lt;p&gt;You should put your functions in the HEAD section of your  document. Functions will work if you put them in the BODY section. However, a function must be loaded  prior to the statement that calls it. Putting all functions in the HEAD  section is the way to insute this. &lt;/p&gt;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br /&gt; function myAdder  (num1, num2){&lt;br /&gt;   var total = num1 +  num2&lt;br /&gt;   document.write(total)&lt;br /&gt;   }&lt;/p&gt;&lt;p&gt;You would place this function inside some &amp;lt;SCRIPT&amp;gt; tags in the head section. You then can call the function from anywhere in  your document. In this example, lets call it from within some  &amp;lt;SCRIPT&amp;gt; tags in the body of document like this. &lt;/p&gt;&lt;p&gt; myAdder(23, 56)&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Scope of Variables &lt;/strong&gt;&lt;br /&gt;A variable that is defined outside of a function is a global variable.  A variable that is defined inside of a function is a local variable.  What does this mean? Global variables can be used anywhere in the  document that is currently loaded in the browser. They can be declared  in the HEAD section and used in any function or even in the BODY  section. Local variables can only be used in the function that declares  them. Yes, you could leave the var keyword off of the variables you  declare inside of a function and they will then be global. I do not  recommend this. &lt;/p&gt;&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3989757413190406423-7371551153465614071?l=lectures-javascript.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3989757413190406423/posts/default/7371551153465614071'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3989757413190406423/posts/default/7371551153465614071'/><link rel='alternate' type='text/html' href='http://lectures-javascript.blogspot.com/2009/04/functions.html' title='Functions'/><author><name>Malik</name><uri>http://www.blogger.com/profile/11760057276874241659</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3989757413190406423.post-8681157858996709538</id><published>2009-04-29T23:37:00.002-07:00</published><updated>2010-04-15T00:25:49.349-07:00</updated><title type='text'>for Loop</title><content type='html'>&lt;script type="text/javascript"&gt;google_ad_client = "pub-1854160677420698";google_ad_slot = "3354353093";google_ad_width = 336;google_ad_height = 280;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;for Loop &lt;/strong&gt;&lt;br /&gt;A repeat loop cycles though a group of statements until some condition  is met. For instance, you can use a repeat loop to cycle though an  array and print it to the screen. Or, you might want to cycle though  the Array and look for some specific information using the if  statement. The for loop is the most common used repeat loop. Here is  the syntax for it.&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Syntax:&lt;/strong&gt;&lt;br /&gt; for ( [initial exp.];  [condition]; [update exp.] ){&lt;br /&gt;    statement(s)&lt;br /&gt;    }&lt;/p&gt;&lt;p&gt;The square bracket means that the parameter is optional. I  always use all three parameters and think you will too. &lt;/p&gt;&lt;p&gt;The  initial expression defines the starting point of the loop. It sets the  value of a variable to some value. The condition tests the variable for  a certain condition and when it is reached stops the loop and lets the  code after for loop execute. The update expression determines how the  variable is incremented. &lt;/p&gt;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br /&gt;Here is a simple example. We will use the "for  loop" to print the numbers 1 through 5 to our screen.&lt;br /&gt;var i&lt;br /&gt; for(i=1; i&amp;lt;=5;  i++){&lt;br /&gt;   document.write(i +  "&amp;lt;BR&amp;gt;")&lt;br /&gt;   }&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Results:&lt;/strong&gt;&lt;br /&gt;1&lt;br /&gt;2&lt;br /&gt;3&lt;br /&gt;4&lt;br /&gt;5&lt;br /&gt;&lt;br /&gt;You can declare the variable as part of initial expression. In fact  this is usually the way it is done. Here is our simple script with this  change. &lt;/p&gt;&lt;p&gt; for(var i=1; i&amp;lt;=5;  i++){&lt;br /&gt;   document.write(i +  "&amp;lt;BR&amp;gt;")&lt;br /&gt;   }&lt;/p&gt;&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3989757413190406423-8681157858996709538?l=lectures-javascript.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3989757413190406423/posts/default/8681157858996709538'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3989757413190406423/posts/default/8681157858996709538'/><link rel='alternate' type='text/html' href='http://lectures-javascript.blogspot.com/2009/04/for-loop.html' title='for Loop'/><author><name>Malik</name><uri>http://www.blogger.com/profile/11760057276874241659</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3989757413190406423.post-5195353045325476211</id><published>2009-04-29T23:37:00.001-07:00</published><updated>2010-04-15T00:25:57.549-07:00</updated><title type='text'>while and do-while Loops</title><content type='html'>&lt;script type="text/javascript"&gt;google_ad_client = "pub-1854160677420698";google_ad_slot = "3354353093";google_ad_width = 336;google_ad_height = 280;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;while and do-while Loops &lt;/strong&gt;&lt;br /&gt;Two additional repeat loops are available in JavaScript. The  while loop tests the supplied condition and continues to execute until it is  met. Here is the syntax for it.&lt;br /&gt;&lt;br /&gt; &lt;strong&gt;Syntax:&lt;/strong&gt;&lt;br /&gt; while (condition){&lt;br /&gt;    statement(s)&lt;br /&gt;    }&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;var i=0;&lt;br /&gt;while (i&amp;lt;=10)&lt;br /&gt;{&lt;br /&gt;document.write("The number is " + i);&lt;br /&gt;document.write("&amp;lt;br /&amp;gt;");&lt;br /&gt;i=i+1;&lt;br /&gt;}&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Result:&lt;/strong&gt;&lt;br /&gt;The number is 0&lt;br /&gt;The number is 1&lt;br /&gt;The number is 2&lt;br /&gt;The number is 3&lt;br /&gt;The number is 4&lt;br /&gt;The number is 5&lt;br /&gt;The number is 6&lt;br /&gt;The number is 7&lt;br /&gt;The number is 8&lt;br /&gt;The number is 9&lt;br /&gt;The number is 10&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Do-while loop:&lt;/strong&gt;&lt;br /&gt;The primary difference between these while and do-while loop  is that the "do-while loop" will always execute one time whether the  condition is true or not whereas the "while loop" will only execute  if the condition is true. &lt;/p&gt;&lt;p&gt;&lt;strong&gt;Syntax:&lt;/strong&gt;&lt;br /&gt; do{&lt;br /&gt;    statements&lt;br /&gt;    } while  (condition)&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;var i=0;&lt;br /&gt;do&lt;br /&gt;{&lt;br /&gt;document.write("The number is " + i);&lt;br /&gt;document.write("&amp;lt;br /&amp;gt;");&lt;br /&gt;i=i+1;&lt;br /&gt;}&lt;br /&gt;while (i&amp;lt;0);&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Result:&lt;/strong&gt;&lt;br /&gt;The number is 0&lt;/p&gt;&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3989757413190406423-5195353045325476211?l=lectures-javascript.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3989757413190406423/posts/default/5195353045325476211'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3989757413190406423/posts/default/5195353045325476211'/><link rel='alternate' type='text/html' href='http://lectures-javascript.blogspot.com/2009/04/while-and-do-while-loops.html' title='while and do-while Loops'/><author><name>Malik</name><uri>http://www.blogger.com/profile/11760057276874241659</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3989757413190406423.post-5426387189130954395</id><published>2009-04-29T23:31:00.001-07:00</published><updated>2010-04-15T00:26:05.399-07:00</updated><title type='text'>JavaScript Popup Boxes</title><content type='html'>&lt;script type="text/javascript"&gt;google_ad_client = "pub-1854160677420698";google_ad_slot = "3354353093";google_ad_width = 336;google_ad_height = 280;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;strong&gt;JavaScript Popup Boxes&lt;/strong&gt;&lt;br /&gt;In JavaScript we can create three kinds of popup boxes: Alert box, Confirm box, and Prompt box.&lt;br /&gt;&lt;p&gt;&lt;strong&gt;Alert Box&lt;/strong&gt;&lt;br /&gt;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 "OK" to proceed. &lt;/p&gt;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br /&gt;alert("sometext");&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Confirm Box&lt;/strong&gt;&lt;br /&gt;A confirm box is often used if you want the user to verify  or accept something.&lt;br /&gt;&lt;br /&gt; When a confirm box pops up, the user will have to click  either "OK" or "Cancel" to proceed. If the user clicks "OK", the box returns true. If the user clicks "Cancel",  the box returns false.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br /&gt;confirm("sometext");&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Prompt Box&lt;/strong&gt;&lt;br /&gt;A prompt box is often used if you want the user to input a  value before entring a page.&lt;br /&gt;&lt;br /&gt; When a prompt box pops up, the user will have to click either "OK" or  "Cancel" to proceed after entering an input value. If the user clicks  "OK" the box returns the input value. If the user clicks "Cancel" the  box returns null.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br /&gt;prompt("sometext","defaultvalue");&lt;/p&gt;&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3989757413190406423-5426387189130954395?l=lectures-javascript.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3989757413190406423/posts/default/5426387189130954395'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3989757413190406423/posts/default/5426387189130954395'/><link rel='alternate' type='text/html' href='http://lectures-javascript.blogspot.com/2009/04/javascript-popup-boxes.html' title='JavaScript Popup Boxes'/><author><name>Malik</name><uri>http://www.blogger.com/profile/11760057276874241659</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3989757413190406423.post-8622211107967398001</id><published>2009-04-26T08:01:00.001-07:00</published><updated>2010-04-15T00:26:14.134-07:00</updated><title type='text'>break and continue Statements</title><content type='html'>&lt;script type="text/javascript"&gt;google_ad_client = "pub-1854160677420698";google_ad_slot = "3354353093";google_ad_width = 336;google_ad_height = 280;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;font face="Times New Roman" size="3"&gt;There are two special statements that can be used inside  loops&lt;/p&gt;&lt;p&gt;&lt;strong&gt;1. break statement:&lt;/strong&gt;&lt;br /&gt;The break command will break the loop and continue executing  the code that follows after the loop (if any).&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;var i=0;&lt;br /&gt;for (i=0;i&amp;lt;=10;i++)&lt;br /&gt;{&lt;br /&gt;if (i==3)&lt;br /&gt;{&lt;br /&gt;break;&lt;br /&gt;}&lt;br /&gt;document.write("The number is " + i);&lt;br /&gt;document.write("&amp;lt;br /&amp;gt;");&lt;br /&gt;}&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Result:&lt;/strong&gt;&lt;br /&gt;The number is 0&lt;br /&gt;The number is 1&lt;br /&gt;The number is 2&lt;/p&gt;&lt;p&gt;&lt;strong&gt;2. continue  statement:&lt;/strong&gt;&lt;br /&gt;The continue command will break the current loop and continue  with the next value.&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Example&lt;/strong&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;var i=0&lt;br /&gt;for (i=0;i&amp;lt;=10;i++)&lt;br /&gt;{&lt;br /&gt;if (i==3)&lt;br /&gt;{&lt;br /&gt;continue;&lt;br /&gt;}&lt;br /&gt;document.write("The number is " + i);&lt;br /&gt;document.write("&amp;lt;br /&amp;gt;");&lt;br /&gt;}&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Result:&lt;/strong&gt;&lt;br /&gt;The number is 0&lt;br /&gt;The number is 1&lt;br /&gt;The number is 2&lt;br /&gt;The number is 4&lt;br /&gt;The number is 5&lt;br /&gt;The number is 6&lt;br /&gt;The number is 7&lt;br /&gt;The number is 8&lt;br /&gt;The number is 9&lt;br /&gt;The number is 10&lt;/p&gt;&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3989757413190406423-8622211107967398001?l=lectures-javascript.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3989757413190406423/posts/default/8622211107967398001'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3989757413190406423/posts/default/8622211107967398001'/><link rel='alternate' type='text/html' href='http://lectures-javascript.blogspot.com/2009/04/break-and-continue-statements.html' title='break and continue Statements'/><author><name>Malik</name><uri>http://www.blogger.com/profile/11760057276874241659</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3989757413190406423.post-6441366089840130555</id><published>2009-04-26T07:51:00.000-07:00</published><updated>2010-04-15T00:26:23.497-07:00</updated><title type='text'>Events</title><content type='html'>&lt;script type="text/javascript"&gt;google_ad_client = "pub-1854160677420698";google_ad_slot = "3354353093";google_ad_width = 336;google_ad_height = 280;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;font face="Times New Roman" size="3"&gt;JavaScript Events are items  that transpire based on an action. A document event is the loading of  an HTML document. A form event is the clicking on a button. Events are  objects with properties.&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br /&gt;&amp;lt;html&amp;gt;&lt;br /&gt;&amp;lt;head&amp;gt;&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;&amp;lt;!--&lt;br /&gt;function popup() {&lt;br /&gt;          alert("Hello  World")&lt;br /&gt;}&lt;br /&gt;//--&amp;gt;&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;br /&gt;&amp;lt;/head&amp;gt;&lt;br /&gt;&amp;lt;body&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;lt;input type="button" value="Click  Me!" onclick="popup()"&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;&amp;lt;a href="#" onmouseover=""  onMouseout="popup()"&amp;gt;&lt;br /&gt;Hover Me!&amp;lt;/a&amp;gt;&lt;/p&gt;&lt;p&gt;&amp;lt;/body&amp;gt;&lt;br /&gt;&amp;lt;/html&amp;gt;&lt;/p&gt;&lt;p&gt;With  the button we used the event onClick event as our desired action and  told it to call our popup function that is defined in our header. To  call a function you must give the function name followed up with  parenthesis "()".&lt;/p&gt;&lt;p&gt;The HTML 4 specification refers to these as intrinsic events  and defines 18 as listed below:&lt;/p&gt;&lt;table width="500" border="0" cellpadding="0" cellspacing="1"&gt;&lt;tbody&gt;&lt;tr&gt; &lt;td width="132"&gt;&lt;strong&gt;Event Handler&lt;/strong&gt; &lt;/td&gt;  &lt;td width="410"&gt;&lt;p&gt;&lt;strong&gt;Event that it handles&lt;/strong&gt;&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;&lt;td width="132"&gt;&lt;p&gt;onBlur&lt;/p&gt;&lt;/td&gt;&lt;td width="410"&gt;&lt;p&gt;User has left the focus of the object. For example, they    clicked away from a text field that was previously selected.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt; &lt;td width="132"&gt;&lt;p&gt;onChange&lt;/p&gt;&lt;/td&gt;&lt;td width="410"&gt;&lt;p&gt;User has changed the object, then attempts to leave that    field (i.e. clicks elsewhere).&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td width="132"&gt;&lt;p&gt;onClick&lt;/p&gt;&lt;/td&gt;&lt;td width="410"&gt;&lt;p&gt;User clicked on the object.&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td width="132"&gt;&lt;p&gt;onDblClick&lt;/p&gt;&lt;/td&gt; &lt;td width="410"&gt;&lt;p&gt;User clicked twice on the object.&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;&lt;td width="132"&gt;&lt;p&gt;onFocus&lt;/p&gt;&lt;/td&gt; &lt;td width="410"&gt;&lt;p&gt;User brought the focus to the object (i.e. clicked on    it/tabbed to it)&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width="132"&gt;&lt;p&gt;onKeydown&lt;/p&gt;&lt;/td&gt;&lt;td width="410"&gt;&lt;p&gt;A key was pressed over an element.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt; &lt;td width="132"&gt;&lt;p&gt;onKeyup&lt;/p&gt;&lt;/td&gt; &lt;td width="410"&gt;&lt;p&gt;A key was released over an element.&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;&lt;td width="132"&gt;&lt;p&gt;onKeypress&lt;/p&gt;&lt;/td&gt;&lt;td width="410"&gt;&lt;p&gt;A key was pressed over an element then released.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt; &lt;td width="132"&gt;&lt;p&gt;onLoad&lt;/p&gt;&lt;/td&gt;&lt;td width="410"&gt;&lt;p&gt;The object has loaded.&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;  &lt;td width="132"&gt;&lt;p&gt;onMousedown&lt;/p&gt;&lt;/td&gt; &lt;td width="410"&gt;&lt;p&gt;The cursor moved over the object and mouse/pointing device    was pressed down.&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td width="132"&gt;&lt;p&gt;onMouseup&lt;/p&gt;&lt;/td&gt;&lt;td width="410"&gt;&lt;p&gt;The mouse/pointing device was released after being pressed    down.&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;&lt;td width="132"&gt;&lt;p&gt;onMouseover&lt;/p&gt;&lt;/td&gt; &lt;td width="410"&gt;&lt;p&gt;The cursor moved over the object (i.e. user hovers the    mouse over the object).&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td width="132"&gt;&lt;p&gt;onMousemove&lt;/p&gt;&lt;/td&gt; &lt;td width="410"&gt;&lt;p&gt;The cursor moved while hovering over an object.&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt; &lt;td width="132"&gt;&lt;p&gt;onMouseout&lt;/p&gt;&lt;/td&gt; &lt;td width="410"&gt;&lt;p&gt;The cursor moved off the object&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt;&lt;tr&gt;&lt;td width="132"&gt;&lt;p&gt;onReset&lt;/p&gt;&lt;/td&gt;&lt;td width="410"&gt;&lt;p&gt;User has reset a form.&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;&lt;td width="132"&gt;&lt;p&gt;onSelect&lt;/p&gt;&lt;/td&gt; &lt;td width="410"&gt;&lt;p&gt;User selected some or all of the contents of the object.    For example, the user selected some text within a text field.&lt;/p&gt;&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;  &lt;td width="132"&gt;&lt;p&gt;onSubmit&lt;/p&gt;&lt;/td&gt; &lt;td width="410"&gt;&lt;p&gt;User submitted a form.&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;  &lt;td width="132"&gt;&lt;p&gt;onUnload&lt;/p&gt;&lt;/td&gt; &lt;td width="410"&gt;&lt;p&gt;User left the window (i.e. user closes the browser    window).&lt;/p&gt;&lt;/td&gt; &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;&lt;p&gt;The events in the above table provide you with many opportunities to trigger  some JavaScript from within your HTML code.&lt;/p&gt;&lt;br /&gt;&lt;/font&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3989757413190406423-6441366089840130555?l=lectures-javascript.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3989757413190406423/posts/default/6441366089840130555'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3989757413190406423/posts/default/6441366089840130555'/><link rel='alternate' type='text/html' href='http://lectures-javascript.blogspot.com/2009/04/events.html' title='Events'/><author><name>Malik</name><uri>http://www.blogger.com/profile/11760057276874241659</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3989757413190406423.post-8425216345925010814</id><published>2009-04-26T07:42:00.001-07:00</published><updated>2010-04-15T00:26:31.762-07:00</updated><title type='text'>Date and Time Object</title><content type='html'>&lt;script type="text/javascript"&gt;google_ad_client = "pub-1854160677420698";google_ad_slot = "3354353093";google_ad_width = 336;google_ad_height = 280;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;font face="Times New Roman" size="3"&gt;The Date object is useful  when you want to display a date or use a timestamp in some sort of  calculation. In Java, you can either make a  Date object by supplying the date of your choice, or you can let JavaScript create a Date object based on your visitor's system clock. It is usually best  to let JavaScript simply use the system clock.&lt;p&gt;&lt;strong&gt;Get the JavaScript  Time&lt;/strong&gt;&lt;br /&gt;The Date object has been created, and now we have a variable that holds  the current date! To get the information we need to print out, we have  to utilize some or all of the following functions:&lt;br /&gt;&lt;/p&gt;&lt;ol&gt;&lt;li&gt;getTime()       - Number of milliseconds since 1/1/1970 @ 12:00 AM&lt;/li&gt; &lt;li&gt;getSeconds()       - Number of Seconds (0-59)&lt;/li&gt; &lt;li&gt;getMinutes()       - Number of minutes (0-59)&lt;/li&gt; &lt;li&gt;getHours()       - Number of hours (0-23)&lt;/li&gt; &lt;li&gt;getDay()       - Day of the week(0-6). 0 = Sunday, ... , 6 = Saturday&lt;/li&gt; &lt;li&gt;getDate()       - Day of the month (0-31)&lt;/li&gt; &lt;li&gt;getMonth()       - Number of month (0-11)&lt;/li&gt; &lt;li&gt;getFullYear()       - The four digit Year (1970-9999)&lt;/li&gt;&lt;/ol&gt;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br /&gt;It is now&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;&amp;lt;!--&lt;br /&gt;var currentTime = new Date()&lt;br /&gt;var month = currentTime.getMonth() + 1&lt;br /&gt;var day = currentTime.getDate()&lt;br /&gt;var year = currentTime.getFullYear()&lt;br /&gt;document.write(month + "/" + day + "/" +  year)&lt;br /&gt;//--&amp;gt;&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;/p&gt;&lt;p&gt;Notice that we added 1 to the &lt;em&gt;month&lt;/em&gt; variable to correct the problem with January being 0 and December being  11. After adding 1, January will be 1, and December will be 12&lt;/p&gt;&lt;p&gt;&lt;strong&gt;Example:&lt;/strong&gt;&lt;br /&gt;It is now&lt;br /&gt;&amp;lt;script type="text/javascript"&amp;gt;&lt;br /&gt;&amp;lt;!--&lt;br /&gt;var currentTime = new Date()&lt;br /&gt;var hours = currentTime.getHours()&lt;br /&gt;var minutes = currentTime.getMinutes()&lt;br /&gt;if (minutes &amp;lt; 10){&lt;br /&gt;minutes = "0" + minutes&lt;br /&gt;}&lt;br /&gt;document.write(hours + ":" + minutes + "  ")&lt;br /&gt;if(hours &amp;gt; 11){&lt;br /&gt;document.write("PM")&lt;br /&gt;} else {&lt;br /&gt;document.write("AM")&lt;br /&gt;}&lt;br /&gt;//--&amp;gt;&lt;br /&gt;&amp;lt;/script&amp;gt;&lt;/p&gt;&lt;/font&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3989757413190406423-8425216345925010814?l=lectures-javascript.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3989757413190406423/posts/default/8425216345925010814'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3989757413190406423/posts/default/8425216345925010814'/><link rel='alternate' type='text/html' href='http://lectures-javascript.blogspot.com/2009/04/date-and-time-object.html' title='Date and Time Object'/><author><name>Malik</name><uri>http://www.blogger.com/profile/11760057276874241659</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3989757413190406423.post-402607610595536381</id><published>2009-04-26T07:14:00.001-07:00</published><updated>2010-04-15T00:26:42.506-07:00</updated><title type='text'>Special Characters</title><content type='html'>&lt;script type="text/javascript"&gt;google_ad_client = "pub-1854160677420698";google_ad_slot = "3354353093";google_ad_width = 336;google_ad_height = 280;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;font face="Times New Roman" size="3"&gt;In JavaScript you can add special characters to a text string by using the backslash sign.&lt;br /&gt;&lt;strong&gt;Insert Special  Characters&lt;/strong&gt;&lt;br /&gt;The backslash (\) is used to insert apostrophes, new lines,  quotes, and other special characters into a text string.&lt;br /&gt;&lt;strong&gt;&lt;br /&gt;Example:&lt;/strong&gt;&lt;br /&gt;var txt="We are the so-called \"Vikings\"  from the north.";&lt;br /&gt;&lt;br /&gt;document.write(txt);&lt;br /&gt;&lt;p&gt;JavaScript will now output the proper text string:&lt;br /&gt;We are the so-called "Vikings" from the north.&lt;/p&gt;&lt;p&gt;The table below lists other special characters that can be  added to a text string with the backslash sign:&lt;/p&gt;&lt;table width="500" border="1" cellpadding="2" cellspacing="0"&gt;&lt;tbody&gt;&lt;tr&gt;&lt;td width="164"&gt;&lt;strong&gt;Code&lt;/strong&gt; &lt;/td&gt;&lt;td width="347"&gt;&lt;strong&gt;Outputs&lt;/strong&gt;&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt; &lt;td&gt;\'&lt;/td&gt;&lt;td&gt;single quote&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;\"&lt;/td&gt;&lt;td&gt;double quote&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;&lt;td&gt;\&amp;amp;&lt;/td&gt;&lt;td&gt;ampersand&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;&lt;td&gt;\\&lt;/td&gt; &lt;td&gt;backslash&lt;/td&gt; &lt;/tr&gt;&lt;tr&gt;&lt;td&gt;\n&lt;/td&gt; &lt;td&gt;new line&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;&lt;td&gt;\r&lt;/td&gt; &lt;td&gt;carriage return&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;&lt;td&gt;\t&lt;/td&gt;&lt;td&gt;tab&lt;/td&gt; &lt;/tr&gt; &lt;tr&gt;&lt;td&gt;\b&lt;/td&gt;&lt;td&gt;backspace&lt;/td&gt;&lt;/tr&gt; &lt;tr&gt;&lt;td&gt;\f&lt;/td&gt;&lt;td&gt;form feed&lt;/td&gt; &lt;/tr&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;/font&gt;&lt;br /&gt;&lt;script type="text/javascript"&gt;var addthis_pub = "qasimbilal";&lt;/script&gt;&lt;br /&gt;&lt;a href="http://www.addthis.com/bookmark.php" onmouseover="return addthis_open(this, '', '[URL]', '[TITLE]')" onmouseout="addthis_close()" onclick="return addthis_sendto()"&gt;&lt;img src="http://s7.addthis.com/static/btn/lg-share-en.gif" alt="" border="0" height="16" width="125" /&gt;&lt;/a&gt;&lt;script type="text/javascript" src="http://s7.addthis.com/js/152/addthis_widget.js"&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3989757413190406423-402607610595536381?l=lectures-javascript.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3989757413190406423/posts/default/402607610595536381'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3989757413190406423/posts/default/402607610595536381'/><link rel='alternate' type='text/html' href='http://lectures-javascript.blogspot.com/2009/04/special-characters.html' title='Special Characters'/><author><name>Malik</name><uri>http://www.blogger.com/profile/11760057276874241659</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry><entry><id>tag:blogger.com,1999:blog-3989757413190406423.post-8230834501199577652</id><published>2009-02-02T02:55:00.000-08:00</published><updated>2010-04-15T00:26:54.398-07:00</updated><title type='text'>Links</title><content type='html'>&lt;script type="text/javascript"&gt;google_ad_client = "pub-1854160677420698";google_ad_slot = "3354353093";google_ad_width = 336;google_ad_height = 280;&lt;/script&gt;&lt;script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;font face="Times New Roman" size="3"&gt;&lt;br /&gt;Java Script&lt;br /&gt;&lt;/font&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/3989757413190406423-8230834501199577652?l=lectures-javascript.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/3989757413190406423/posts/default/8230834501199577652'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/3989757413190406423/posts/default/8230834501199577652'/><link rel='alternate' type='text/html' href='http://lectures-javascript.blogspot.com/2009/02/java-script.html' title='Links'/><author><name>Malik</name><uri>http://www.blogger.com/profile/11760057276874241659</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author></entry></feed>
