<?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-7722578078463485731</id><updated>2011-11-27T15:45:10.381-08:00</updated><category term='Tutorial'/><category term='Java Script'/><title type='text'>Java Script Faq's &amp;</title><subtitle type='html'>Interview Questionas &amp;amp; Answers</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://javascriptfaqs.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7722578078463485731/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://javascriptfaqs.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</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>10</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7722578078463485731.post-4287935821036494584</id><published>2009-01-02T02:22:00.000-08:00</published><updated>2009-01-02T02:24:34.530-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Tutorial'/><title type='text'>JavaScript Tutorial</title><content type='html'>&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 12"&gt;&lt;meta name="Originator" content="Microsoft Word 12"&gt;&lt;link rel="File-List" href="file:///D:%5CUSERPR%7E1%5Csshende%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml"&gt;&lt;link rel="Edit-Time-Data" href="file:///D:%5CUSERPR%7E1%5Csshende%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_editdata.mso"&gt;&lt;!--[if !mso]&gt; &lt;style&gt; v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VML);} .shape {behavior:url(#default#VML);} &lt;/style&gt; &lt;![endif]--&gt;&lt;o:smarttagtype namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="date"&gt;&lt;/o:smarttagtype&gt;&lt;o:smarttagtype namespaceuri="urn:schemas-microsoft-com:office:smarttags" name="place"&gt;&lt;/o:smarttagtype&gt;&lt;link rel="themeData" href="file:///D:%5CUSERPR%7E1%5Csshende%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx"&gt;&lt;link rel="colorSchemeMapping" href="file:///D:%5CUSERPR%7E1%5Csshende%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:trackmoves/&gt;   &lt;w:trackformatting/&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:donotpromoteqf/&gt;   &lt;w:lidthemeother&gt;EN-US&lt;/w:LidThemeOther&gt;   &lt;w:lidthemeasian&gt;JA&lt;/w:LidThemeAsian&gt;   &lt;w:lidthemecomplexscript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;    &lt;w:splitpgbreakandparamark/&gt;    &lt;w:dontvertaligncellwithsp/&gt;    &lt;w:dontbreakconstrainedforcedtables/&gt;    &lt;w:dontvertalignintxbx/&gt;    &lt;w:word11kerningpairs/&gt;    &lt;w:cachedcolbalance/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;   &lt;m:mathpr&gt;    &lt;m:mathfont val="Cambria Math"&gt;    &lt;m:brkbin val="before"&gt;    &lt;m:brkbinsub val="&amp;#45;-"&gt;    &lt;m:smallfrac val="off"&gt;    &lt;m:dispdef/&gt;    &lt;m:lmargin val="0"&gt;    &lt;m:rmargin val="0"&gt;    &lt;m:defjc val="centerGroup"&gt;    &lt;m:wrapindent val="1440"&gt;    &lt;m:intlim val="subSup"&gt;    &lt;m:narylim val="undOvr"&gt;   &lt;/m:mathPr&gt;&lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" defunhidewhenused="true" defsemihidden="true" defqformat="false" defpriority="99" latentstylecount="267"&gt;   &lt;w:lsdexception locked="false" priority="0" semihidden="false" unhidewhenused="false" qformat="true" name="Normal"&gt;   &lt;w:lsdexception locked="false" priority="9" semihidden="false" unhidewhenused="false" qformat="true" name="heading 1"&gt;   &lt;w:lsdexception locked="false" priority="0" qformat="true" name="heading 2"&gt;   &lt;w:lsdexception locked="false" priority="0" qformat="true" name="heading 3"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 4"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 5"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 6"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 7"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 8"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 9"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 1"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 2"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 3"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 4"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 5"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 6"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 7"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 8"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 9"&gt;   &lt;w:lsdexception locked="false" priority="35" qformat="true" name="caption"&gt;   &lt;w:lsdexception locked="false" priority="10" semihidden="false" unhidewhenused="false" qformat="true" name="Title"&gt;   &lt;w:lsdexception locked="false" priority="1" name="Default Paragraph Font"&gt;   &lt;w:lsdexception locked="false" priority="11" semihidden="false" unhidewhenused="false" qformat="true" name="Subtitle"&gt;   &lt;w:lsdexception locked="false" priority="0" name="Hyperlink"&gt;   &lt;w:lsdexception locked="false" priority="22" semihidden="false" unhidewhenused="false" qformat="true" name="Strong"&gt;   &lt;w:lsdexception locked="false" priority="20" semihidden="false" unhidewhenused="false" qformat="true" name="Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="0" name="Normal (Web)"&gt;   &lt;w:lsdexception locked="false" priority="0" name="HTML Preformatted"&gt;   &lt;w:lsdexception locked="false" priority="0" name="No List"&gt;   &lt;w:lsdexception locked="false" priority="59" semihidden="false" unhidewhenused="false" name="Table Grid"&gt;   &lt;w:lsdexception locked="false" unhidewhenused="false" name="Placeholder Text"&gt;   &lt;w:lsdexception locked="false" priority="1" semihidden="false" unhidewhenused="false" qformat="true" name="No Spacing"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" unhidewhenused="false" name="Revision"&gt;   &lt;w:lsdexception locked="false" priority="34" semihidden="false" unhidewhenused="false" qformat="true" name="List Paragraph"&gt;   &lt;w:lsdexception locked="false" priority="29" semihidden="false" unhidewhenused="false" qformat="true" name="Quote"&gt;   &lt;w:lsdexception locked="false" priority="30" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Quote"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="19" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="21" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="31" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Reference"&gt;   &lt;w:lsdexception locked="false" priority="32" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Reference"&gt;   &lt;w:lsdexception locked="false" priority="33" semihidden="false" unhidewhenused="false" qformat="true" name="Book Title"&gt;   &lt;w:lsdexception locked="false" priority="37" name="Bibliography"&gt;   &lt;w:lsdexception locked="false" priority="39" qformat="true" name="TOC Heading"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if !mso]&gt;&lt;object classid="clsid:38481807-CA0E-42D2-BF39-B33AF135CC4D" id="ieooui"&gt;&lt;/object&gt; &lt;style&gt; st1\:*{behavior:url(#ieooui) } &lt;/style&gt; &lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face 	{font-family:Wingdings; 	panose-1:5 0 0 0 0 0 0 0 0 0; 	mso-font-charset:2; 	mso-generic-font-family:auto; 	mso-font-pitch:variable; 	mso-font-signature:0 268435456 0 0 -2147483648 0;} @font-face 	{font-family:"Cambria Math"; 	panose-1:2 4 5 3 5 4 6 3 2 4; 	mso-font-charset:1; 	mso-generic-font-family:roman; 	mso-font-format:other; 	mso-font-pitch:variable; 	mso-font-signature:0 0 0 0 0 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-unhide:no; 	mso-style-qformat:yes; 	mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Times New Roman","serif"; 	mso-fareast-font-family:"Times New Roman"; 	mso-fareast-language:EN-US;} h2 	{mso-style-unhide:no; 	mso-style-qformat:yes; 	mso-style-link:"Heading 2 Char"; 	mso-margin-top-alt:auto; 	margin-right:0in; 	mso-margin-bottom-alt:auto; 	margin-left:0in; 	mso-pagination:widow-orphan; 	mso-outline-level:2; 	font-size:18.0pt; 	font-family:"Times New Roman","serif"; 	mso-fareast-language:EN-US; 	font-weight:bold;} h3 	{mso-style-unhide:no; 	mso-style-qformat:yes; 	mso-style-link:"Heading 3 Char"; 	mso-style-next:Normal; 	margin-top:12.0pt; 	margin-right:0in; 	margin-bottom:3.0pt; 	margin-left:0in; 	mso-pagination:widow-orphan; 	page-break-after:avoid; 	mso-outline-level:3; 	font-size:13.0pt; 	font-family:"Arial","sans-serif"; 	mso-fareast-language:EN-US; 	font-weight:bold;} a:link, span.MsoHyperlink 	{mso-style-unhide:no; 	color:blue; 	text-decoration:underline; 	text-underline:single;} a:visited, span.MsoHyperlinkFollowed 	{mso-style-noshow:yes; 	mso-style-priority:99; 	color:purple; 	mso-themecolor:followedhyperlink; 	text-decoration:underline; 	text-underline:single;} p 	{mso-style-unhide:no; 	mso-margin-top-alt:auto; 	margin-right:0in; 	mso-margin-bottom-alt:auto; 	margin-left:0in; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Times New Roman","serif"; 	mso-fareast-font-family:"Times New Roman"; 	mso-fareast-language:EN-US;} pre 	{mso-style-unhide:no; 	mso-style-link:"HTML Preformatted Char"; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	tab-stops:45.8pt 91.6pt 137.4pt 183.2pt 229.0pt 274.8pt 320.6pt 366.4pt 412.2pt 458.0pt 503.8pt 549.6pt 595.4pt 641.2pt 687.0pt 732.8pt; 	font-size:10.0pt; 	font-family:"Courier New"; 	mso-fareast-font-family:"Times New Roman"; 	mso-fareast-language:EN-US;} span.Heading2Char 	{mso-style-name:"Heading 2 Char"; 	mso-style-unhide:no; 	mso-style-locked:yes; 	mso-style-link:"Heading 2"; 	mso-ansi-font-size:18.0pt; 	mso-bidi-font-size:18.0pt; 	mso-fareast-language:EN-US; 	font-weight:bold;} span.Heading3Char 	{mso-style-name:"Heading 3 Char"; 	mso-style-unhide:no; 	mso-style-locked:yes; 	mso-style-link:"Heading 3"; 	mso-ansi-font-size:13.0pt; 	mso-bidi-font-size:13.0pt; 	font-family:"Arial","sans-serif"; 	mso-ascii-font-family:Arial; 	mso-hansi-font-family:Arial; 	mso-bidi-font-family:Arial; 	mso-fareast-language:EN-US; 	font-weight:bold;} p.intro, li.intro, div.intro 	{mso-style-name:intro; 	mso-style-unhide:no; 	mso-margin-top-alt:auto; 	margin-right:0in; 	mso-margin-bottom-alt:auto; 	margin-left:0in; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Times New Roman","serif"; 	mso-fareast-font-family:"Times New Roman"; 	mso-fareast-language:EN-US;} span.HTMLPreformattedChar 	{mso-style-name:"HTML Preformatted Char"; 	mso-style-unhide:no; 	mso-style-locked:yes; 	mso-style-link:"HTML Preformatted"; 	font-family:"Courier New"; 	mso-ascii-font-family:"Courier New"; 	mso-hansi-font-family:"Courier New"; 	mso-bidi-font-family:"Courier New"; 	mso-fareast-language:EN-US;} span.insert 	{mso-style-name:insert; 	mso-style-unhide:no;} .MsoChpDefault 	{mso-style-type:export-only; 	mso-default-props:yes; 	font-size:10.0pt; 	mso-ansi-font-size:10.0pt; 	mso-bidi-font-size:10.0pt;} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;}  /* List Definitions */  @list l0 	{mso-list-id:598291006; 	mso-list-template-ids:1345366354;} @list l0:level1 	{mso-level-number-format:bullet; 	mso-level-text:; 	mso-level-tab-stop:.5in; 	mso-level-number-position:left; 	text-indent:-.25in; 	mso-ansi-font-size:10.0pt; 	font-family:Symbol;} @list l1 	{mso-list-id:750272980; 	mso-list-template-ids:729680298;} @list l1:level1 	{mso-level-number-format:bullet; 	mso-level-text:; 	mso-level-tab-stop:.5in; 	mso-level-number-position:left; 	text-indent:-.25in; 	mso-ansi-font-size:10.0pt; 	font-family:Symbol;} @list l2 	{mso-list-id:1068504548; 	mso-list-template-ids:199919846;} @list l2:level1 	{mso-level-number-format:bullet; 	mso-level-text:; 	mso-level-tab-stop:.5in; 	mso-level-number-position:left; 	text-indent:-.25in; 	mso-ansi-font-size:10.0pt; 	font-family:Symbol;} @list l3 	{mso-list-id:1088889200; 	mso-list-template-ids:546200090;} @list l3:level1 	{mso-level-number-format:bullet; 	mso-level-text:; 	mso-level-tab-stop:.5in; 	mso-level-number-position:left; 	text-indent:-.25in; 	mso-ansi-font-size:10.0pt; 	font-family:Symbol;} @list l4 	{mso-list-id:1285193070; 	mso-list-template-ids:-1973512076;} @list l4:level1 	{mso-level-number-format:bullet; 	mso-level-text:; 	mso-level-tab-stop:.5in; 	mso-level-number-position:left; 	text-indent:-.25in; 	mso-ansi-font-size:10.0pt; 	font-family:Symbol;} @list l5 	{mso-list-id:1311866300; 	mso-list-template-ids:-1270448692;} @list l5:level1 	{mso-level-number-format:bullet; 	mso-level-text:; 	mso-level-tab-stop:.5in; 	mso-level-number-position:left; 	text-indent:-.25in; 	mso-ansi-font-size:10.0pt; 	font-family:Symbol;} @list l6 	{mso-list-id:1485974262; 	mso-list-template-ids:-1228130174;} @list l6:level1 	{mso-level-number-format:bullet; 	mso-level-text:; 	mso-level-tab-stop:.5in; 	mso-level-number-position:left; 	text-indent:-.25in; 	mso-ansi-font-size:10.0pt; 	font-family:Symbol;} @list l7 	{mso-list-id:1556353740; 	mso-list-template-ids:-1293661860;} @list l7:level1 	{mso-level-number-format:bullet; 	mso-level-text:; 	mso-level-tab-stop:.5in; 	mso-level-number-position:left; 	text-indent:-.25in; 	mso-ansi-font-size:10.0pt; 	font-family:Symbol;} @list l8 	{mso-list-id:1711489136; 	mso-list-template-ids:-2034473464;} @list l8:level1 	{mso-level-number-format:bullet; 	mso-level-text:; 	mso-level-tab-stop:.5in; 	mso-level-number-position:left; 	text-indent:-.25in; 	mso-ansi-font-size:10.0pt; 	font-family:Symbol;} @list l9 	{mso-list-id:1764840910; 	mso-list-template-ids:630992932;} @list l9:level1 	{mso-level-number-format:bullet; 	mso-level-text:; 	mso-level-tab-stop:.5in; 	mso-level-number-position:left; 	text-indent:-.25in; 	mso-ansi-font-size:10.0pt; 	font-family:Symbol;} @list l10 	{mso-list-id:2115054792; 	mso-list-template-ids:2034005866;} @list l10:level1 	{mso-level-number-format:bullet; 	mso-level-text:; 	mso-level-tab-stop:.5in; 	mso-level-number-position:left; 	text-indent:-.25in; 	mso-ansi-font-size:10.0pt; 	font-family:Symbol;} @list l11 	{mso-list-id:2145807942; 	mso-list-template-ids:-1496406554;} @list l11:level1 	{mso-level-number-format:bullet; 	mso-level-text:; 	mso-level-tab-stop:.5in; 	mso-level-number-position:left; 	text-indent:-.25in; 	mso-ansi-font-size:10.0pt; 	font-family:Symbol;} ol 	{margin-bottom:0in;} ul 	{margin-bottom:0in;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-priority:99; 	mso-style-qformat:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman","serif";} &lt;/style&gt; &lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;o:shapedefaults ext="edit" spidmax="1030"&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;o:shapelayout ext="edit"&gt;   &lt;o:idmap ext="edit" data="1"&gt;  &lt;/o:shapelayout&gt;&lt;/xml&gt;&lt;![endif]--&gt;  &lt;h2&gt;&lt;br /&gt;&lt;/h2&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="0" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0in; width: 75pt;" width="100"&gt;   &lt;p class="MsoNormal"&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shapetype id="_x0000_t75" coordsize="21600,21600" spt="75" preferrelative="t" path="m@4@5l@4@11@9@11@9@5xe" filled="f" stroked="f"&gt;    &lt;v:stroke joinstyle="miter"&gt;    &lt;v:formulas&gt;     &lt;v:f eqn="if lineDrawn pixelLineWidth 0"&gt;     &lt;v:f eqn="sum @0 1 0"&gt;     &lt;v:f eqn="sum 0 0 @1"&gt;     &lt;v:f eqn="prod @2 1 2"&gt;     &lt;v:f eqn="prod @3 21600 pixelWidth"&gt;     &lt;v:f eqn="prod @3 21600 pixelHeight"&gt;     &lt;v:f eqn="sum @0 0 1"&gt;     &lt;v:f eqn="prod @6 1 2"&gt;     &lt;v:f eqn="prod @7 21600 pixelWidth"&gt;     &lt;v:f eqn="sum @8 21600 0"&gt;     &lt;v:f eqn="prod @7 21600 pixelHeight"&gt;     &lt;v:f eqn="sum @10 21600 0"&gt;    &lt;/v:formulas&gt;    &lt;v:path extrusionok="f" gradientshapeok="t" connecttype="rect"&gt;    &lt;o:lock ext="edit" aspectratio="t"&gt;   &lt;/v:shapetype&gt;&lt;v:shape id="_x0000_i1139" type="#_x0000_t75" alt="picture" style="'width:63pt;height:60pt'/"&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;br /&gt;&lt;!--[endif]--&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0in;" valign="top"&gt;   &lt;p class="intro"&gt;JavaScript is &lt;i&gt;the&lt;/i&gt; scripting language of the Web!&lt;/p&gt;   &lt;p class="intro"&gt;JavaScript is used in millions of Web pages to improve the   design, validate forms, detect browsers, create cookies, and much more.&lt;/p&gt;   &lt;p class="intro"&gt;JavaScript is the most popular scripting language on the   internet.&lt;/p&gt;   &lt;p class="intro"&gt;JavaScript is easy to learn! You will enjoy it! &lt;/p&gt;   &lt;p&gt;&lt;a href="http://www.w3schools.com/js/js_intro.asp"&gt;Start learning   JavaScript now!&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;span style=""&gt; &lt;/span&gt;&lt;/p&gt;  &lt;p class="intro"&gt;JavaScript is used in millions of Web pages to improve the design, validate forms, detect browsers, create cookies, and much more.&lt;/p&gt;  &lt;p class="intro"&gt;JavaScript is the most popular scripting language on the internet, and works in all major browsers, such as Internet Explorer, Mozilla, Firefox, Netscape, Opera.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;What You Should Already Know&lt;/h2&gt;  &lt;p&gt;Before you continue you should have a basic understanding of the following:&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;HTML / XHTML &lt;/li&gt;&lt;/ul&gt;  &lt;p&gt;If you want to study these subjects first, find the tutorials on our &lt;a href="http://www.w3schools.com/default.asp"&gt;Home page&lt;/a&gt;.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;What is JavaScript?&lt;/h2&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;JavaScript was designed to      add interactivity to HTML pages &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;JavaScript is a scripting      language (a scripting language is a lightweight programming language) &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;A JavaScript consists of      lines of executable computer code &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;A JavaScript is usually      embedded directly into HTML pages &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;JavaScript is an interpreted      language (means that scripts execute without preliminary compilation) &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;Everyone can use JavaScript      without purchasing a license &lt;/li&gt;&lt;/ul&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Are Java and JavaScript the Same?&lt;/h2&gt;  &lt;p&gt;NO!&lt;/p&gt;  &lt;p&gt;Java and JavaScript are two completely different languages in both concept and design!&lt;/p&gt;  &lt;p&gt;Java (developed by Sun Microsystems) is a powerful and much more complex programming language - in the same category as C and C++.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;What can a JavaScript Do?&lt;/h2&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;JavaScript gives HTML      designers a programming tool - &lt;/b&gt;HTML authors are normally not      programmers, but JavaScript is a scripting language with a very simple      syntax! Almost anyone can put small "snippets" of code into      their HTML pages &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;JavaScript can put dynamic      text into an HTML page - &lt;/b&gt;A JavaScript statement like this:      document.write("&lt;h1&gt;" + name + "&lt;/h1&gt;")      can write a variable text into an HTML page &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;JavaScript can react to      events - &lt;/b&gt;A JavaScript can be set to execute when something happens,      like when a page has finished loading or when a user clicks on an HTML      element &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;JavaScript can read and      write HTML elements - &lt;/b&gt;A JavaScript can read and change the content of      an HTML element &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;JavaScript can be used to      validate data - &lt;/b&gt;A JavaScript can be used to validate form data before      it is submitted to a server, this will save the server from extra      processing &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;JavaScript can be used to      detect the visitor's browser&lt;/b&gt; - A JavaScript can be used to detect the      visitor's browser, and - depending on the browser - load another page      specifically designed for that browser &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;JavaScript can be used to      create cookies&lt;/b&gt; - A JavaScript can be used to store and retrieve      information on the visitor's computer &lt;/li&gt;&lt;/ul&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;p class="intro"&gt;The HTML &lt;script&gt; tag is used to insert a JavaScript into an HTML page.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Examples&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_text" target="_blank"&gt;Write text&lt;/a&gt;&lt;br /&gt;How to write text on a page.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_formattext" target="_blank"&gt;Write text with formatting&lt;/a&gt;&lt;br /&gt;How to format the text on your page with HTML tags.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;How to Put a JavaScript Into an HTML Page&lt;/h2&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;html&gt;&lt;/pre&gt;&lt;pre&gt;&lt;body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="insert"&gt;&lt;script type="text/javascript"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="insert"&gt;document.write("Hello World!")&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="insert"&gt;&lt;/script&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/html&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The code above will produce this output on an HTML page:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;Hello World! &lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;h3&gt;Example Explained&lt;/h3&gt;  &lt;p&gt;To insert a JavaScript into an HTML page, we use the &lt;script&gt; tag (also use the type attribute to define the scripting language).&lt;/p&gt;  &lt;p&gt;So, the &lt;script type="text/javascript"&gt; and &lt;/script&gt; tells where the JavaScript starts and ends:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;html&gt;&lt;/pre&gt;&lt;pre&gt;&lt;body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="insert"&gt;&lt;script type="text/javascript"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="insert"&gt;...&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="insert"&gt;&lt;/script&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/html&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The word &lt;b&gt;document.write&lt;/b&gt; is a standard JavaScript command for writing output to a page.&lt;/p&gt;  &lt;p&gt;By entering the document.write command between the &lt;script type="text/javascript"&gt; and &lt;/script&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;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;html&gt;&lt;/pre&gt;&lt;pre&gt;&lt;body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="insert"&gt;&lt;script type="text/javascript"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="insert"&gt;document.write("Hello World!")&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="insert"&gt;&lt;/script&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/html&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; If we had not entered the &lt;script&gt; tag, the browser would have treated the document.write("Hello World!") command as pure text, and just write the entire line on the page.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Ending Statements With a Semicolon?&lt;/h2&gt;  &lt;p&gt;With traditional programming languages, like C++ and Java, each code statement has to end with a semicolon.&lt;/p&gt;  &lt;p&gt;Many programmers continue this habit when writing JavaScript, but in general, semicolons are &lt;b&gt;optional&lt;/b&gt;! However, semicolons are required if you want to put more than one statement on a single line.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;How to Handle Older Browsers&lt;/h2&gt;  &lt;p&gt;Browsers that do not support JavaScript will display the script as page content. To prevent them from doing this, we may use the HTML comment tag:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;span class="insert"&gt;&lt;script type="text/javascript"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="insert"&gt;&lt;!--&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="insert"&gt;document.write("Hello World!")&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="insert"&gt;//--&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="insert"&gt;&lt;/script&gt;&lt;/span&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The two forward slashes at the end of comment line (//) are a JavaScript comment symbol. This prevents the JavaScript compiler from compiling the line.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;p class="intro"&gt;JavaScripts in the body section will be executed WHILE the page loads.&lt;/p&gt;  &lt;p class="intro"&gt;JavaScripts in the head section will be executed when CALLED.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Examples&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_headsection" target="_blank"&gt;Head section&lt;/a&gt;&lt;br /&gt;Scripts that contain functions go in the head section of the document. Then we can be sure that the script is loaded before the function is called.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_bodysection" target="_blank"&gt;Body section&lt;/a&gt;&lt;br /&gt;Execute a script that is placed in the body section.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_externalexample" target="_blank"&gt;External script&lt;/a&gt;&lt;br /&gt;How to access an external script.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Where to Put the JavaScript&lt;/h2&gt;  &lt;p&gt;JavaScripts in a page will be executed immediately while the page loads into the browser. This is not always what we want. Sometimes we want to execute a script when a page loads, other times when a user triggers an event.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Scripts in the head section:&lt;/b&gt; Scripts to be executed when they are called, or when an event is triggered, go in the head section. When you place a script in the head section, you will ensure that the script is loaded before anyone uses it. &lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;html&gt;&lt;/pre&gt;&lt;pre&gt;&lt;head&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="insert"&gt;&lt;script type="text/javascript"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="insert"&gt;....&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="insert"&gt;&lt;/script&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/head&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;b&gt;Scripts in the body section:&lt;/b&gt; Scripts to be executed when the page loads go in the body section. When you place a script in the body section it generates the content of the page.&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;html&gt;&lt;/pre&gt;&lt;pre&gt;&lt;head&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/head&gt;&lt;/pre&gt;&lt;pre&gt;&lt;body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="insert"&gt;&lt;script type="text/javascript"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="insert"&gt;....&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="insert"&gt;&lt;/script&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/body&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;b&gt;Scripts in both the body and the head section:&lt;/b&gt; You can place an unlimited number of scripts in your document, so you can have scripts in both the body and the head section.&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;html&gt;&lt;/pre&gt;&lt;pre&gt;&lt;head&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="insert"&gt;&lt;script type="text/javascript"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="insert"&gt;....&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="insert"&gt;&lt;/script&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/head&gt;&lt;/pre&gt;&lt;pre&gt;&lt;body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="insert"&gt;&lt;script type="text/javascript"&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="insert"&gt;....&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="insert"&gt;&lt;/script&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/body&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Using an External JavaScript&lt;/h2&gt;  &lt;p&gt;Sometimes you might want to run the same JavaScript on several pages, without having to write the same script on every page.&lt;/p&gt;  &lt;p&gt;To simplify this, you can write a JavaScript in an external file. Save the external JavaScript file with a .js file extension.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; The external script cannot contain the &lt;script&gt; tag!&lt;/p&gt;  &lt;p&gt;To use the external script, point to the .js file in the "src" attribute of the &lt;script&gt; tag:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;html&gt;&lt;/pre&gt;&lt;pre&gt;&lt;head&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="insert"&gt;&lt;script src="xxx.js"&gt;&lt;/script&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/head&gt;&lt;/pre&gt;&lt;pre&gt;&lt;body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/html&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; Remember to place the script exactly where you normally would write the script!&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;p class="intro"&gt;A variable is a "container" for information you want to store.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Examples&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_variable" target="_blank"&gt;Variable&lt;/a&gt;&lt;br /&gt;Variables are used to store data. This example will show you how.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Variables&lt;/h2&gt;  &lt;p&gt;A variable is a "container" for information you want to store. A variable's value can change during the script. You can refer to a variable by name to see its value or to change its value.&lt;/p&gt;  &lt;p&gt;Rules for variable names:&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;Variable names are case      sensitive &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;They must begin with a letter      or the underscore character &lt;/li&gt;&lt;/ul&gt;  &lt;p&gt;&lt;b&gt;IMPORTANT!&lt;/b&gt; JavaScript is case-sensitive! A variable named strname is not the same as a variable named STRNAME!&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Declare a Variable&lt;/h2&gt;  &lt;p&gt;You can create a variable with the var statement:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;var strname = &lt;i&gt;some value&lt;/i&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;You can also create a variable without the var statement:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;strname = &lt;i&gt;some value&lt;/i&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Assign a Value to a Variable&lt;/h2&gt;  &lt;p&gt;You can assign a value to a variable like this:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;var strname = "Hege"&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;Or like this:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;strname = "Hege"&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The variable name is on the left side of the expression and the value you want to assign to the variable is on the right. Now the variable "strname" has the value "Hege".&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Lifetime of Variables&lt;/h2&gt;  &lt;p&gt;When you declare a variable within a function, the variable can only be accessed within that function. When you exit the function, the variable is destroyed. These variables are called local variables. You can have local variables with the same name in different functions, because each is recognized only by the function in which it is declared.&lt;/p&gt;  &lt;p&gt;If you declare a variable outside a function, all the functions on your page can access it. The lifetime of these variables starts when they are declared, and ends when the page is closed.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;p class="intro"&gt;Conditional statements in JavaScript are used to perform different actions based on different conditions.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Examples&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_ifthen" target="_blank"&gt;If statement&lt;/a&gt;&lt;br /&gt;How to write an if statement.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_ifthenelse" target="_blank"&gt;If...else statement&lt;/a&gt;&lt;br /&gt;How to write an if...else statement.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_elseif" target="_blank"&gt;If..else if...else statement&lt;/a&gt;&lt;br /&gt;How to write an if..else if...else statement.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_randomlink" target="_blank"&gt;Random link&lt;/a&gt;&lt;br /&gt;This example demonstrates a link, when you click on the link it will take you to W3Schools.com OR to RefsnesData.no. There is a 50% chance for each of them.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Conditional Statements&lt;/h2&gt;  &lt;p&gt;Very often when you write code, you want to perform different actions for different decisions. You can use conditional statements in your code to do this.&lt;/p&gt;  &lt;p&gt;In JavaScript we have the following conditional statements:&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;if statement&lt;/b&gt; - use      this statement if you want to execute some code only if a specified      condition is true &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;if...else statement&lt;/b&gt; -      use this statement if you want to execute some code if the condition is      true and another code if the condition is false &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;if...else if....else      statement&lt;/b&gt; - use this statement if you want to select one of many      blocks of code to be executed &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;switch statement&lt;/b&gt; -      use this statement if you want to select one of many blocks of code to be      executed &lt;/li&gt;&lt;/ul&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;If Statement&lt;/h2&gt;  &lt;p&gt;You should use the if statement if you want to execute some code only if a specified condition is true.&lt;/p&gt;  &lt;h3&gt;Syntax&lt;/h3&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;if (&lt;i&gt;condition&lt;/i&gt;)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;code to be executed if condition is true&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;Note that if is written in lowercase letters. Using uppercase letters (IF) will generate a JavaScript error!&lt;/p&gt;  &lt;h3&gt;Example 1&lt;/h3&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;script type="text/javascript"&gt;&lt;/pre&gt;&lt;pre&gt;//Write a "Good morning" greeting if&lt;/pre&gt;&lt;pre&gt;//the time is less than 10&lt;/pre&gt;&lt;pre&gt;var d=new Date()&lt;/pre&gt;&lt;pre&gt;var time=d.getHours()&lt;/pre&gt;&lt;pre&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;if (time&lt;10)&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;document.write("&lt;b&gt;Good morning&lt;/b&gt;")&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;/script&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;h3&gt;Example 2&lt;/h3&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;script type="text/javascript"&gt;&lt;/pre&gt;&lt;pre&gt;//Write "Lunch-time!" if the time is 11&lt;/pre&gt;&lt;pre&gt;var d=new Date()&lt;/pre&gt;&lt;pre&gt;var time=d.getHours()&lt;/pre&gt;&lt;pre&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;if (time==11) &lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;document.write("&lt;b&gt;Lunch-time!&lt;/b&gt;")&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;/script&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; When &lt;b&gt;comparing&lt;/b&gt; variables you must always use two equals signs next to each other (==)!&lt;/p&gt;  &lt;p&gt;Notice that there is no ..else.. in this syntax. You just tell the code to execute some code &lt;b&gt;only if the specified condition is true&lt;/b&gt;.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;If...else Statement&lt;/h2&gt;  &lt;p&gt;If you want to execute some code if a condition is true and another code if the condition is not true, use the if....else statement.&lt;/p&gt;  &lt;h3&gt;Syntax&lt;/h3&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;if (&lt;i&gt;condition&lt;/i&gt;)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;code to be executed if condition is true&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;else&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;code to be executed if condition is not true&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;h3&gt;Example&lt;/h3&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;script type="text/javascript"&gt;&lt;/pre&gt;&lt;pre&gt;//If the time is less than 10,&lt;/pre&gt;&lt;pre&gt;//you will get a "Good morning" greeting.&lt;/pre&gt;&lt;pre&gt;//Otherwise you will get a "Good day" greeting.&lt;/pre&gt;&lt;pre&gt;var d = new Date()&lt;/pre&gt;&lt;pre&gt;var time = d.getHours()&lt;/pre&gt;&lt;pre&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;if (time &lt;&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;document.write("Good morning!")&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;else&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;document.write("Good day!")&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;/script&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;If...else if...else Statement&lt;/h2&gt;  &lt;p&gt;You should use the if....else if...else statement if you want to select one of many sets of lines to execute.&lt;/p&gt;  &lt;h3&gt;Syntax&lt;/h3&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;if (&lt;i&gt;condition1&lt;/i&gt;)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;code to be executed if condition1 is true&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;else if (&lt;i&gt;condition2&lt;/i&gt;)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;code to be executed if condition2 is true&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;else&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;code to be executed if condition1 and&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;condition2 are not true&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;h3&gt;Example&lt;/h3&gt;  &lt;table class="MsoNormalTable" style="width: 101%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;script type="text/javascript"&gt;&lt;/pre&gt;&lt;pre&gt;var d = new Date()&lt;/pre&gt;&lt;pre&gt;var time = d.getHours()&lt;/pre&gt;&lt;pre&gt;if (time&lt;10)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;document.write("&lt;b&gt;Good morning&lt;/b&gt;")&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;else if (time&gt;10 &amp;amp;&amp;amp; time&lt;16)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;document.write("&lt;b&gt;Good day&lt;/b&gt;")&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;else&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;document.write("&lt;b&gt;Hello World!&lt;/b&gt;")&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;/script&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;p class="intro"&gt;Conditional statements in JavaScript are used to perform different actions based on different conditions.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Examples&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_switch" target="_blank"&gt;Switch statement&lt;/a&gt;&lt;br /&gt;How to write a switch statement.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;The JavaScript Switch Statement&lt;/h2&gt;  &lt;p&gt;You should use the switch statement if you want to select one of many blocks of code to be executed.&lt;/p&gt;  &lt;h3&gt;Syntax&lt;/h3&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;switch(n)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;case 1:&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;i&gt;execute code block 1&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;break&lt;span style=""&gt;    &lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;case 2:&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;i&gt;execute code block 2&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt; &lt;span style=""&gt; &lt;/span&gt;break&lt;/pre&gt;&lt;pre&gt;default:&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;&lt;span style=""&gt;  &lt;/span&gt;code to be executed if n is&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;&lt;span style=""&gt;  &lt;/span&gt;different from case 1 and 2&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;This is how it works: First we have a single expression &lt;i&gt;n&lt;/i&gt; (most often a variable), that is evaluated once. The value of the expression is then compared with the values for each case in the structure. If there is a match, the block of code associated with that case is executed. Use &lt;b&gt;break&lt;/b&gt; to prevent the code from running into the next case automatically.&lt;/p&gt;  &lt;h3&gt;Example&lt;/h3&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;script type="text/javascript"&gt;&lt;/pre&gt;&lt;pre&gt;//You will receive a different greeting based&lt;/pre&gt;&lt;pre&gt;//on what day it is. Note that Sunday=0,&lt;/pre&gt;&lt;pre&gt;//Monday=1, Tuesday=2, etc.&lt;/pre&gt;&lt;pre&gt;var d=new Date()&lt;/pre&gt;&lt;pre&gt;theDay=d.getDay()&lt;/pre&gt;&lt;pre&gt;switch (theDay)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;case 5:&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;document.write("Finally Friday")&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;break&lt;/pre&gt;&lt;pre&gt;case 6:&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;document.write("Super Saturday")&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;break&lt;/pre&gt;&lt;pre&gt;case 0:&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;document.write("Sleepy Sunday")&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;break&lt;/pre&gt;&lt;pre&gt;default:&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;document.write("I'm looking forward to this weekend!")&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;/script&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;h2&gt;Arithmetic Operators&lt;/h2&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt; width: 15%;" width="15%"&gt;   &lt;p class="MsoNormal"&gt;&lt;b&gt;Operator&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 40%;" width="40%"&gt;   &lt;p class="MsoNormal"&gt;&lt;b&gt;Description&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 25%;" width="25%"&gt;   &lt;p class="MsoNormal"&gt;&lt;b&gt;Example&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 20%;" width="20%"&gt;   &lt;p class="MsoNormal"&gt;&lt;b&gt;Result&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;+&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Addition &lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;x=2&lt;br /&gt;  y=2&lt;br /&gt;  x+y &lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;4 &lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;-&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Subtraction &lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;x=5&lt;br /&gt;  y=2&lt;br /&gt;  x-y &lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;3&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;*&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Multiplication &lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;x=5&lt;br /&gt;  y=4&lt;br /&gt;  x*y&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;20&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;/&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Division &lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;15/5&lt;br /&gt;  5/2 &lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;3&lt;br /&gt;  2.5&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;%&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Modulus (division remainder) &lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;5%2&lt;br /&gt;  10%8&lt;br /&gt;  10%2&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;1&lt;br /&gt;  2&lt;br /&gt;  0&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;++&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Increment&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;x=5&lt;br /&gt;  x++ &lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;x=6 &lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;--&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Decrement&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;x=5&lt;br /&gt;  x-- &lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;x=4 &lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;h2&gt;Assignment Operators&lt;/h2&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt; width: 15%;" width="15%"&gt;   &lt;p class="MsoNormal"&gt;&lt;b&gt;Operator&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 40%;" width="40%"&gt;   &lt;p class="MsoNormal"&gt;&lt;b&gt;Example&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 45%;" width="45%"&gt;   &lt;p class="MsoNormal"&gt;&lt;b&gt;Is The Same As&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;=&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;x=y&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;x=y&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;+=&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;x+=y &lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;x=x+y &lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;-=&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;x-=y &lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;x=x-y &lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;*=&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;x*=y &lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;x=x*y &lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;/=&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;x/=y &lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;x=x/y&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;%=&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;x%=y &lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;x=x%y&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;h2&gt;Comparison Operators&lt;/h2&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt; width: 15%;" width="15%"&gt;   &lt;p class="MsoNormal"&gt;&lt;b&gt;Operator&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 45%;" width="45%"&gt;   &lt;p class="MsoNormal"&gt;&lt;b&gt;Description&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 40%;" width="40%"&gt;   &lt;p class="MsoNormal"&gt;&lt;b&gt;Example&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;==&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;is equal to &lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;5==8 returns false &lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;===&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;is equal to (checks for both value and type)&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;x=5&lt;br /&gt;  y="5" &lt;/p&gt;   &lt;p&gt;x==y returns true&lt;br /&gt;  x===y returns false&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;!=&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;is not equal &lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;5!=8 returns true &lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;is greater than &lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;5&gt;8 returns false &lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;is less than &lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;5&lt;8&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&gt;=&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;is greater than or equal to &lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;5&gt;=8 returns false&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;=&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;is less than or equal to &lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;5&lt;=8 returns true&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;h2&gt;Logical Operators&lt;/h2&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt; width: 15%;" width="15%"&gt;   &lt;p class="MsoNormal"&gt;&lt;b&gt;Operator&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 45%;" width="45%"&gt;   &lt;p class="MsoNormal"&gt;&lt;b&gt;Description&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 40%;" width="40%"&gt;   &lt;p class="MsoNormal"&gt;&lt;b&gt;Example&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&amp;amp;&amp;amp;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;and &lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;x=6&lt;br /&gt;  y=3 &lt;/p&gt;   &lt;p&gt;(x &lt;&gt; 1) returns true&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;||&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;or &lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;x=6&lt;br /&gt;  y=3 &lt;/p&gt;   &lt;p&gt;(x==5 || y==5) returns false&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;!&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;not &lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;x=6&lt;br /&gt;  y=3 &lt;/p&gt;   &lt;p&gt;!(x==y) returns true&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;h2&gt;String Operator&lt;/h2&gt;  &lt;p&gt;A string is most often text, for example "Hello World!". To stick two or more string variables together, use the + operator.&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;txt1="What a very"&lt;/pre&gt;&lt;pre&gt;txt2="nice day!"&lt;/pre&gt;&lt;pre&gt;txt3=txt1+txt2 &lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The variable txt3 now contains "What a verynice day!".&lt;/p&gt;  &lt;p&gt;To add a space between two string variables, insert a space into the expression, OR in one of the strings.&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;txt1="What a very"&lt;/pre&gt;&lt;pre&gt;txt2="nice day!"&lt;/pre&gt;&lt;pre&gt;txt3=txt1+" "+txt2&lt;/pre&gt;&lt;pre&gt;or&lt;/pre&gt;&lt;pre&gt;txt1="What a very "&lt;/pre&gt;&lt;pre&gt;txt2="nice day!"&lt;/pre&gt;&lt;pre&gt;txt3=txt1+txt2&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The variable txt3 now contains "What a very nice day!".&lt;/p&gt;  &lt;h2&gt;Conditional Operator&lt;/h2&gt;  &lt;p&gt;JavaScript also contains a conditional operator that assigns a value to a variable based on some condition.&lt;/p&gt;  &lt;h3&gt;Syntax&lt;/h3&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;variablename=(condition)?value1:value2 &lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;h3&gt;Example&lt;/h3&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;greeting=(visitor=="PRES")?"Dear President ":"Dear "&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;If the variable visitor is equal to PRES, then put the string "Dear President " in the variable named greeting. If the variable visitor is not equal to PRES, then put the string "Dear " into the variable named greeting.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;p class="intro"&gt;In JavaScript we can create three kind of popup boxes: Alert box, Confirm box, and Prompt box.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Examples&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_alert" target="_blank"&gt;Alert box&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_alert2" target="_blank"&gt;Alert box with line breaks&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_confirm" target="_blank"&gt;Confirm box&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_prompt" target="_blank"&gt;Prompt box&lt;/a&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Alert Box&lt;/h2&gt;  &lt;p&gt;An alert box is often used if you want to make sure information comes through to the user.&lt;/p&gt;  &lt;p&gt;When an alert box pops up, the user will have to click "OK" to proceed. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Syntax:&lt;/b&gt;&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;alert("sometext")&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Confirm Box&lt;/h2&gt;  &lt;p&gt;A confirm box is often used if you want the user to verify or accept something.&lt;/p&gt;  &lt;p&gt;When a confirm box pops up, the user will have to click either "OK" or "Cancel" to proceed. &lt;/p&gt;  &lt;p&gt;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;b&gt;Syntax:&lt;/b&gt;&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;confirm("sometext")&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Prompt Box&lt;/h2&gt;  &lt;p&gt;A prompt box is often used if you want the user to input a value before entering a page.&lt;/p&gt;  &lt;p&gt;When a prompt box pops up, the user will have to click either "OK" or "Cancel" to proceed after entering an input value. &lt;/p&gt;  &lt;p&gt;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;b&gt;Syntax:&lt;/b&gt;&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;prompt("sometext","defaultvalue")&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;p class="intro"&gt;A function is a reusable code-block that will be executed by an event, or when the function is called.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Examples&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_function1" target="_blank"&gt;Function&lt;/a&gt;&lt;br /&gt;How to call a function.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_function2" target="_blank"&gt;Function with arguments&lt;/a&gt;&lt;br /&gt;How to pass a variable to a function, and use the variable in the function.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_functionarg2" target="_blank"&gt;Function with arguments 2&lt;/a&gt;&lt;br /&gt;How to pass variables to a function, and use these variables in the function.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_function_return2" target="_blank"&gt;Function that returns a value&lt;/a&gt;&lt;br /&gt;How to let the function return a value.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_function_return" target="_blank"&gt;A function with arguments, that returns a value&lt;/a&gt;&lt;br /&gt;How to let the function find the product of 2 arguments and return the result.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;JavaScript Functions&lt;/h2&gt;  &lt;p&gt;To keep the browser from executing a script as soon as the page is loaded, you can write your script as a function.&lt;/p&gt;  &lt;p&gt;A function contains some code that will be executed only by an event or by a call to that function.&lt;/p&gt;  &lt;p&gt;You may call a function from anywhere within the page (or even from other pages if the function is embedded in an external .js file).&lt;/p&gt;  &lt;p&gt;Functions are defined at the beginning of a page, in the &lt;head&gt; section.&lt;/p&gt;  &lt;h3&gt;Example&lt;/h3&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;html&gt;&lt;/pre&gt;&lt;pre&gt;&lt;head&gt;&lt;/pre&gt;&lt;pre&gt;&lt;script type="text/javascript"&gt;&lt;/pre&gt;&lt;pre&gt;function displaymessage()&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;alert("Hello World!")&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;/script&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/head&gt;&lt;/pre&gt;&lt;pre&gt;&lt;body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;form&gt;&lt;/pre&gt;&lt;pre&gt;&lt;input type="button" value="Click me!"&gt;&lt;pre&gt;onclick="displaymessage()" &gt;&lt;/pre&gt;&lt;pre&gt;&lt;/form&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/html&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;br /&gt;If the line: alert("Hello world!!"), in the example above had not been written within a function, it would have been executed as soon as the line was loaded. Now, the script is not executed before the user hits the button. We have added an onClick event to the button that will execute the function displaymessage() when the button is clicked. &lt;/p&gt;  &lt;p&gt;You will learn more about JavaScript events in the JS Events chapter.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;How to Define a Function&lt;/h2&gt;  &lt;p&gt;The syntax for creating a function is:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;function &lt;i&gt;functionname&lt;/i&gt;(&lt;i&gt;var1,var2,...,varX&lt;/i&gt;)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;some code&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;var1, var2, etc are variables or values passed into the function. The { and the } defines the start and end of the function.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; A function with no parameters must include the parentheses () after the function name:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;function &lt;i&gt;functionname&lt;/i&gt;()&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;i&gt;some code&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; Do not forget about the importance of capitals in JavaScript! The word function must be written in lowercase letters, otherwise a JavaScript error occurs! Also note that you must call a function with the exact same capitals as in the function name.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;The return Statement&lt;/h2&gt;  &lt;p&gt;The return statement is used to specify the value that is returned from the function.&lt;/p&gt;  &lt;p&gt;So, functions that are going to return a value must use the return statement.&lt;/p&gt;  &lt;h3&gt;Example&lt;/h3&gt;  &lt;p&gt;The function below should return the product of two numbers (a and b):&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;function prod(a,b)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;x=a*b&lt;/pre&gt;&lt;pre&gt;return x&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;When you call the function above, you must pass along two parameters:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;product=prod(2,3)&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The returned value from the prod() function is 6, and it will be stored in the variable called product.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;p class="intro"&gt;Loops in JavaScript are used to execute the same block of code a specified number of times or while a specified condition is true.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Examples&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_fornext" target="_blank"&gt;For loop&lt;/a&gt;&lt;br /&gt;How to write a for loop. Use a For loop to run the same block of code a specified number of times.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_fornext_header" target="_blank"&gt;Looping through HTML headers&lt;/a&gt;&lt;br /&gt;How to use the for loop to loop through the different HTML headers.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;JavaScript Loops&lt;/h2&gt;  &lt;p&gt;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.&lt;/p&gt;  &lt;p&gt;In JavaScript there are two different kind of loops:&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;for &lt;/b&gt;- loops through a      block of code a specified number of times &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;&lt;b&gt;while &lt;/b&gt;- loops through      a block of code while a specified condition is true &lt;/li&gt;&lt;/ul&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;The for &lt;st1:place st="on"&gt;Loop&lt;/st1:place&gt;&lt;/h2&gt;  &lt;p&gt;The for loop is used when you know in advance how many times the script should run.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Syntax&lt;/b&gt;&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;for (var=startvalue;var&lt;=endvalue;var=var+increment) &lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;i&gt;code to be executed&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;b&gt;Example&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;Explanation: The example below defines a loop that starts with i=0. The loop will continue to run as long as &lt;b&gt;i&lt;/b&gt; is less than, or equal to 10. &lt;b&gt;i&lt;/b&gt; will increase by 1 each time the loop runs.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; The increment parameter could also be negative, and the &lt;= could be any comparing statement.&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;html&gt;&lt;/pre&gt;&lt;pre&gt;&lt;body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;script type="text/javascript"&gt;&lt;/pre&gt;&lt;pre&gt;var i=0&lt;/pre&gt;&lt;pre&gt;for (i=0;i&lt;=10;i++)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;document.write("The number is " + i)&lt;/pre&gt;&lt;pre&gt;document.write("&lt;br /&gt;")&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;/script&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/html&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;b&gt;Result&lt;/b&gt;&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;The number is 0&lt;/pre&gt;&lt;pre&gt;The number is 1&lt;/pre&gt;&lt;pre&gt;The number is 2&lt;/pre&gt;&lt;pre&gt;The number is 3&lt;/pre&gt;&lt;pre&gt;The number is 4&lt;/pre&gt;&lt;pre&gt;The number is 5&lt;/pre&gt;&lt;pre&gt;The number is 6&lt;/pre&gt;&lt;pre&gt;The number is 7&lt;/pre&gt;&lt;pre&gt;The number is 8&lt;/pre&gt;&lt;pre&gt;The number is 9&lt;/pre&gt;&lt;pre&gt;The number is 10&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;The while loop&lt;/h2&gt;  &lt;p&gt;The while loop will be explained in the next chapter.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;p class="intro"&gt;Loops in JavaScript are used to execute the same block of code a specified number of times or while a specified condition is true.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Examples&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_while" target="_blank"&gt;While loop&lt;/a&gt;&lt;br /&gt;How to write a while loop. Use a while loop to run the same block of code while a specified condition is true.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_dowhile" target="_blank"&gt;Do while loop&lt;/a&gt;&lt;br /&gt;How to write a do...while loop. Use a do...while loop to run the same block of code while a specified condition is true. This loop will always be executed at least once, even if the condition is false, because the statements are executed before the condition is tested.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;The while loop&lt;/h2&gt;  &lt;p&gt;The while loop is used when you want the loop to execute and continue executing while the specified condition is true. &lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;while (var&lt;=endvalue)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;i&gt;code to be executed&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; The &lt;= could be any comparing statement.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Example&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;Explanation: The example below defines a loop that starts with i=0. The loop will continue to run as long as &lt;b&gt;i&lt;/b&gt; is less than, or equal to 10. &lt;b&gt;i&lt;/b&gt; will increase by 1 each time the loop runs.&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;html&gt;&lt;/pre&gt;&lt;pre&gt;&lt;body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;script type="text/javascript"&gt;&lt;/pre&gt;&lt;pre&gt;var i=0&lt;/pre&gt;&lt;pre&gt;while (i&lt;=10)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;document.write("The number is " + i)&lt;/pre&gt;&lt;pre&gt;document.write("&lt;br /&gt;")&lt;/pre&gt;&lt;pre&gt;i=i+1&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;/script&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/html&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;b&gt;Result&lt;/b&gt;&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;The number is 0&lt;/pre&gt;&lt;pre&gt;The number is 1&lt;/pre&gt;&lt;pre&gt;The number is 2&lt;/pre&gt;&lt;pre&gt;The number is 3&lt;/pre&gt;&lt;pre&gt;The number is 4&lt;/pre&gt;&lt;pre&gt;The number is 5&lt;/pre&gt;&lt;pre&gt;The number is 6&lt;/pre&gt;&lt;pre&gt;The number is 7&lt;/pre&gt;&lt;pre&gt;The number is 8&lt;/pre&gt;&lt;pre&gt;The number is 9&lt;/pre&gt;&lt;pre&gt;The number is 10&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;h2&gt;The do...while &lt;st1:place st="on"&gt;Loop&lt;/st1:place&gt;&lt;/h2&gt;  &lt;p&gt;The do...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.&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;do&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;i&gt;code to be executed&lt;o:p&gt;&lt;/o:p&gt;&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;while (var&lt;=endvalue)&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;b&gt;Example&lt;/b&gt;&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;html&gt;&lt;/pre&gt;&lt;pre&gt;&lt;body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;script type="text/javascript"&gt;&lt;/pre&gt;&lt;pre&gt;var i=0&lt;/pre&gt;&lt;pre&gt;do &lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;document.write("The number is " + i)&lt;/pre&gt;&lt;pre&gt;document.write("&lt;br /&gt;")&lt;/pre&gt;&lt;pre&gt;i=i+1&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;while (i&lt;0)&lt;/pre&gt;&lt;pre&gt;&lt;/script&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/html&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;b&gt;Result&lt;/b&gt;&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;The number is 0&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;p class="intro"&gt;There are two special statements that can be used inside loops: break and continue.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Examples&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_break" target="_blank"&gt;Break statement&lt;/a&gt;&lt;br /&gt;Use the break statement to break the loop.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_continue" target="_blank"&gt;Continue statement&lt;/a&gt;&lt;br /&gt;Use the continue statement to break the current loop and continue with the next value.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;JavaScript break and continue Statements&lt;/h2&gt;  &lt;p&gt;There are two special statements that can be used inside loops: break and continue.&lt;/p&gt;  &lt;h3&gt;Break&lt;/h3&gt;  &lt;p&gt;The break command will break the loop and continue executing the code that follows after the loop (if any).&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Example&lt;/b&gt;&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;html&gt;&lt;/pre&gt;&lt;pre&gt;&lt;body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;script type="text/javascript"&gt;&lt;/pre&gt;&lt;pre&gt;var i=0&lt;/pre&gt;&lt;pre&gt;for (i=0;i&lt;=10;i++)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;if (i==3){break}&lt;/pre&gt;&lt;pre&gt;document.write("The number is " + i)&lt;/pre&gt;&lt;pre&gt;document.write("&lt;br /&gt;")&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;/script&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/html&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;b&gt;Result&lt;/b&gt;&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;The number is 0&lt;/pre&gt;&lt;pre&gt;The number is 1&lt;/pre&gt;&lt;pre&gt;The number is 2&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;h3&gt;Continue&lt;/h3&gt;  &lt;p&gt;The continue command will break the current loop and continue with the next value.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Example&lt;/b&gt;&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;html&gt;&lt;/pre&gt;&lt;pre&gt;&lt;body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;script type="text/javascript"&gt;&lt;/pre&gt;&lt;pre&gt;var i=0&lt;/pre&gt;&lt;pre&gt;for (i=0;i&lt;=10;i++)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;if (i==3){continue}&lt;/pre&gt;&lt;pre&gt;document.write("The number is " + i)&lt;/pre&gt;&lt;pre&gt;document.write("&lt;br /&gt;")&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;/script&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/html&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;b&gt;Result&lt;/b&gt;&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;The number is 0&lt;/pre&gt;&lt;pre&gt;The number is 1&lt;/pre&gt;&lt;pre&gt;The number is 2&lt;/pre&gt;&lt;pre&gt;The number is 4&lt;/pre&gt;&lt;pre&gt;The number is 5&lt;/pre&gt;&lt;pre&gt;The number is 6&lt;/pre&gt;&lt;pre&gt;The number is 7&lt;/pre&gt;&lt;pre&gt;The number is 8&lt;/pre&gt;&lt;pre&gt;The number is 9&lt;/pre&gt;&lt;pre&gt;The number is 10&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;p class="intro"&gt;The for...in statement is used to loop (iterate) through the elements of an array or through the properties of an object.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Examples&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_array_for_in" target="_blank"&gt;For...In statement&lt;/a&gt;&lt;br /&gt;How to use a for...in statement to loop through the elements of an array.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;JavaScript For...In Statement&lt;/h2&gt;  &lt;p&gt;The for...in statement is used to loop (iterate) through the elements of an array or through the properties of an object.&lt;/p&gt;  &lt;p&gt;The code in the body of the for ... in loop is executed once for each element/property.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Syntax&lt;/b&gt;&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;for (variable in object)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;    &lt;/span&gt;&lt;i&gt;code to be executed&lt;/i&gt;&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The variable argument can be a named variable, an array element, or a property of an object.&lt;/p&gt;  &lt;h3&gt;Example&lt;/h3&gt;  &lt;p&gt;Using for...in to loop through an array:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;html&gt;&lt;/pre&gt;&lt;pre&gt;&lt;body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;script type="text/javascript"&gt;&lt;/pre&gt;&lt;pre&gt;var x&lt;/pre&gt;&lt;pre&gt;var mycars = new Array()&lt;/pre&gt;&lt;pre&gt;mycars[0] = "Saab"&lt;/pre&gt;&lt;pre&gt;mycars[1] = "Volvo"&lt;/pre&gt;&lt;pre&gt;mycars[2] = "BMW"&lt;/pre&gt;&lt;pre&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;for (x in mycars)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;document.write(mycars[x] + "&lt;br /&gt;")&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;/script&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/html&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;p class="intro"&gt;Events are actions that can be detected by JavaScript.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Events&lt;/h2&gt;  &lt;p&gt;By using JavaScript, we have the ability to create dynamic web pages. Events are actions that can be detected by JavaScript.&lt;/p&gt;  &lt;p&gt;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 a user clicks on the button. We define the events in the HTML tags.&lt;/p&gt;  &lt;p&gt;Examples of events:&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;A mouse click &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;A web page or an image      loading &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;Mousing over a hot spot on      the web page &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;Selecting an input box in an      HTML form &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;Submitting an HTML form &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;A keystroke &lt;/li&gt;&lt;/ul&gt;  &lt;p&gt;The following table lists the events recognized by JavaScript:&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; Events are normally used in combination with functions, and the function will not be executed before the event occurs!&lt;/p&gt;  &lt;p&gt;For a complete reference of the events recognized by JavaScript, go to our &lt;a href="http://www.w3schools.com/jsref/jsref_events.asp"&gt;complete Event reference&lt;/a&gt;.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;onload and onUnload&lt;/h2&gt;  &lt;p&gt;The onload and onUnload events are triggered when the user enters or leaves the page.&lt;/p&gt;  &lt;p&gt;The onload event is often used to check the visitor's browser type and browser version, and load the proper version of the web page based on the information.&lt;/p&gt;  &lt;p&gt;Both the onload and onUnload events are also often used to deal with cookies that should be set when a user enters or leaves a page. For example, you could have a popup asking for the user'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 popup saying something like: "Welcome John Doe!".&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;onFocus, onBlur and onChange&lt;/h2&gt;  &lt;p&gt;The onFocus, onBlur and onChange events are often used in combination with validation of form fields.&lt;/p&gt;  &lt;p&gt;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:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;input type="text" size="30"&gt;&lt;pre&gt;id="email" onchange="checkEmail()"&gt;;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;onSubmit&lt;/h2&gt;  &lt;p&gt;The onSubmit event is used to validate ALL form fields before submitting it.&lt;/p&gt;  &lt;p&gt;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:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;form method="post" action="xxx.htm"&gt;&lt;pre&gt;onsubmit="return checkForm()"&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;onMouseOver and onMouseOut&lt;/h2&gt;  &lt;p&gt;onMouseOver and onMouseOut are often used to create "animated" buttons.&lt;/p&gt;  &lt;p&gt;Below is an example of an onMouseOver event. An alert box appears when an onMouseOver event is detected:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;a href="http://www.w3schools.com"&gt;&lt;pre&gt;onmouseover="alert('An onMouseOver event');return false"&gt;&lt;/pre&gt;&lt;pre&gt;&lt;img src="w3schools.gif" width="100" height="30" /&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/a&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;p class="intro"&gt;The try...catch statement allows you to test a block of code for errors.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Examples&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_try_catch" target="_blank"&gt;The try...catch statement&lt;/a&gt;&lt;br /&gt;How to write a try...catch statement.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_try_catch2" target="_blank"&gt;The try...catch statement with a confirm box&lt;/a&gt;&lt;br /&gt;Another example of how to write a try...catch statement.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;JavaScript - Catching Errors&lt;/h2&gt;  &lt;p&gt;When browsing Web pages on the internet, I guess we have all seen a JavaScript alert box, telling you there is a runtime error, and asking: "Do you wish to debug?" on some pages. Error message like that may be useful for developers, but not for the users. When users see errors, they often leave the Web page.&lt;/p&gt;  &lt;p&gt;This chapter will teach you how to trap and handle JavaScript error messages, so you don't lose your audience.&lt;/p&gt;  &lt;p&gt;There are two ways of catching errors in a Web page:&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;By using the &lt;b&gt;try...catch&lt;/b&gt;      statement (available in IE5+, Mozilla 1.0, and Netscape 6) &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;By using the &lt;b&gt;onerror&lt;/b&gt;      event. This is the old standard solution to catch errors (available since      Netscape 3) &lt;/li&gt;&lt;/ul&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Try...Catch Statement&lt;/h2&gt;  &lt;p&gt;The try...catch statement allows you to test a block of code for errors. The try block contains the code to be run, and the catch block contains the code to be executed if an error occurs.&lt;/p&gt;  &lt;h3&gt;Syntax&lt;/h3&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;try&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;//Run some code here&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;catch(err)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;//Handle errors here&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;Note that try...catch is written in lowercase letters. Using uppercase letters will generate a JavaScript error!&lt;/p&gt;  &lt;h3&gt;Example 1&lt;/h3&gt;  &lt;p&gt;The example below contains a script that is supposed to display the message "Welcome guest!" when you click on a button. However, there's a typo in the message() function. alert() is misspelled as adddlert(). A JavaScript error occurs:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;html&gt;&lt;/pre&gt;&lt;pre&gt;&lt;head&gt;&lt;/pre&gt;&lt;pre&gt;&lt;script type="text/javascript"&gt;&lt;/pre&gt;&lt;pre&gt;function message()&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;adddlert("Welcome guest!")&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;/script&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/head&gt;&lt;/pre&gt;&lt;pre&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;input type="button" value="View message" onclick="message()"&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/html&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;To take more appropriate action when an error occurs, you can add a try...catch statement.&lt;/p&gt;  &lt;p&gt;The example below contains the "Welcome guest!" example rewritten to use the try...catch statement. Since alert() is misspelled, a JavaScript error occurs. However, this time, the catch block catches the error and executes a custom code to handle it. The code displays a custom error message informing the user what happened:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;html&gt;&lt;/pre&gt;&lt;pre&gt;&lt;head&gt;&lt;/pre&gt;&lt;pre&gt;&lt;script type="text/javascript"&gt;&lt;/pre&gt;&lt;pre&gt;var txt=""&lt;/pre&gt;&lt;pre&gt;function message()&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;try&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;adddlert("Welcome guest!")&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;catch(err)&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;txt="There was an error on this page.\n\n"&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;txt+="Error description: " + err.description + "\n\n"&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;txt+="Click OK to continue.\n\n"&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;alert(txt)&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;/script&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/head&gt;&lt;/pre&gt;&lt;pre&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;input type="button" value="View message" onclick="message()"&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/html&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;h3&gt;Example 2&lt;/h3&gt;  &lt;p&gt;The next example uses a confirm box to display a custom message telling users they can click OK to continue viewing the page or click Cancel to go to the homepage. If the confirm method returns false, the user clicked Cancel, and the code redirects the user. If the confirm method returns true, the code does nothing:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;html&gt;&lt;/pre&gt;&lt;pre&gt;&lt;head&gt;&lt;/pre&gt;&lt;pre&gt;&lt;script type="text/javascript"&gt;&lt;/pre&gt;&lt;pre&gt;var txt=""&lt;/pre&gt;&lt;pre&gt;function message()&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;try&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;adddlert("Welcome guest!")&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;catch(err)&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;txt="There was an error on this page.\n\n"&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;txt+="Click OK to continue viewing this page,\n"&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;txt+="or Cancel to return to the home page.\n\n"&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;if(!confirm(txt))&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;    &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;    &lt;/span&gt;document.location.href="http://www.w3schools.com/"&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;   &lt;/span&gt;&lt;span style=""&gt; &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;/script&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/head&gt;&lt;/pre&gt;&lt;pre&gt;&lt;body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;input type="button" value="View message" onclick="message()"&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/html&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;The onerror Event&lt;/h2&gt;  &lt;p&gt;The onerror event will be explained soon, but first you will learn how to use the throw statement to create an exception. The throw statement can be used together with the try...catch statement.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;p class="intro"&gt;The throw statement allows you to create an exception.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Examples&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_throw" target="_blank"&gt;The throw statement&lt;/a&gt;&lt;br /&gt;How to use the throw statement.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;The Throw Statement&lt;/h2&gt;  &lt;p&gt;The throw statement allows you to create an exception. If you use this statement together with the try...catch statement, you can control program flow and generate accurate error messages.&lt;/p&gt;  &lt;h3&gt;Syntax&lt;/h3&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;throw(exception)&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The exception can be a string, integer, Boolean or an object.&lt;/p&gt;  &lt;p&gt;Note that throw is written in lowercase letters. Using uppercase letters will generate a JavaScript error!&lt;/p&gt;  &lt;h3&gt;Example 1&lt;/h3&gt;  &lt;p&gt;The example below determines the value of a variable called x. If the value of x is higher than 10 or lower than 0 we are going to throw an error. The error is then caught by the catch argument and the proper error message is displayed:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;html&gt;&lt;/pre&gt;&lt;pre&gt;&lt;body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;script type="text/javascript"&gt;&lt;/pre&gt;&lt;pre&gt;var x=prompt("Enter a number between 0 and 10:","")&lt;/pre&gt;&lt;pre&gt;try&lt;/pre&gt;&lt;pre&gt;{ &lt;/pre&gt;&lt;pre&gt;if(x&gt;10) &lt;/pre&gt;&lt;pre&gt;throw "Err1" &lt;/pre&gt;&lt;pre&gt;else if(x&lt;0)&lt;/pre&gt;&lt;pre&gt;throw "Err2"&lt;/pre&gt;&lt;pre&gt;} &lt;/pre&gt;&lt;pre&gt;catch(er)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;if(er=="Err1") &lt;/pre&gt;&lt;pre&gt;alert("Error! The value is too high")&lt;/pre&gt;&lt;pre&gt;if(er == "Err2") &lt;/pre&gt;&lt;pre&gt;alert("Error! The value is too low") &lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;/script&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/html&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;span style="display: none;"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/span&gt;&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;p class="intro"&gt;Using the onerror event is the old standard solution to catch errors in a web page.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Examples&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_onerror" target="_blank"&gt;The onerror event&lt;/a&gt;&lt;br /&gt;How to use the onerror event to catch errors in a web page.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;The onerror Event&lt;/h2&gt;  &lt;p&gt;We have just explained how to use the try...catch statement to catch errors in a web page. Now we are going to explain how to use the onerror event for the same purpose.&lt;/p&gt;  &lt;p&gt;The onerror event is fired whenever there is a script error in the page.&lt;/p&gt;  &lt;p&gt;To use the onerror event, you must create a function to handle the errors. Then you call the function with the onerror event handler. The event handler is called with three arguments: msg (error message), url (the url of the page that caused the error) and line (the line where the error occurred).&lt;/p&gt;  &lt;h3&gt;Syntax&lt;/h3&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;onerror=handleErr&lt;/pre&gt;&lt;pre&gt;function handleErr(msg,url,l)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;//Handle the error here&lt;/pre&gt;&lt;pre&gt;return true or false&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The value returned by onerror determines whether the browser displays a standard error message. If you return false, the browser displays the standard error message in the JavaScript console. If you return true, the browser does not display the standard error message.&lt;/p&gt;  &lt;h3&gt;Example&lt;/h3&gt;  &lt;p&gt;The following example shows how to catch the error with the onerror event:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;html&gt;&lt;/pre&gt;&lt;pre&gt;&lt;head&gt;&lt;/pre&gt;&lt;pre&gt;&lt;script type="text/javascript"&gt;&lt;/pre&gt;&lt;pre&gt;onerror=handleErr&lt;/pre&gt;&lt;pre&gt;var txt=""&lt;/pre&gt;&lt;pre&gt;function handleErr(msg,url,l)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;txt="There was an error on this page.\n\n"&lt;/pre&gt;&lt;pre&gt;txt+="Error: " + msg + "\n"&lt;/pre&gt;&lt;pre&gt;txt+="URL: " + url + "\n"&lt;/pre&gt;&lt;pre&gt;txt+="Line: " + l + "\n\n"&lt;/pre&gt;&lt;pre&gt;txt+="Click OK to continue.\n\n"&lt;/pre&gt;&lt;pre&gt;alert(txt)&lt;/pre&gt;&lt;pre&gt;return true&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;function message()&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;adddlert("Welcome guest!")&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;/script&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/head&gt;&lt;/pre&gt;&lt;pre&gt;&lt;body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;input type="button" value="View message" onclick="message()"&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/html&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;p class="intro"&gt;In JavaScript you can add special characters to a text string by using the backslash sign.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Insert Special Characters&lt;/h2&gt;  &lt;p&gt;The backslash (\) is used to insert apostrophes, new lines, quotes, and other special characters into a text string.&lt;/p&gt;  &lt;p&gt;Look at the following JavaScript code:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;var txt="We are the so-called "Vikings" from the north."&lt;/pre&gt;&lt;pre&gt;document.write(txt)&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;In JavaScript, a string is started and stopped with either single or double quotes. This means that the string above will be chopped to: We are the so-called&lt;/p&gt;  &lt;p&gt;To solve this problem, you must place a backslash (\) before each double quote in "Viking". This turns each double quote into a string literal:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;var txt="We are the so-called \"Vikings\" from the north."&lt;/pre&gt;&lt;pre&gt;document.write(txt)&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;JavasScript will now output the proper text string: We are the so-called "Vikings" from the north.&lt;/p&gt;  &lt;p&gt;Here is another example:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;document.write ("You \&amp;amp; me are singing!") &lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The example above will produce the following output:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;You &amp;amp; me are singing!&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&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 class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;b&gt;Code&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;&lt;b&gt;Outputs&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;\'&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;single quote&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;\"&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;double quote&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;\&amp;amp;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;ampersand&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;\\&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;backslash&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;\n&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;new line&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;\r&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;carriage return&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;\t&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;tab&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;\b&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;backspace&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;\f&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;"&gt;   &lt;p class="MsoNormal"&gt;form feed&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;p class="intro"&gt;Some other important things to know when scripting with JavaScript. &lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;JavaScript is Case Sensitive&lt;/h2&gt;  &lt;p&gt;A function named "myfunction" is not the same as "myFunction" and a variable named "myVar" is not the same as "myvar".&lt;/p&gt;  &lt;p&gt;JavaScript is case sensitive - therefore watch your capitalization closely when you create or call variables, objects and functions.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;White Space&lt;/h2&gt;  &lt;p&gt;JavaScript ignores extra spaces. You can add white space to your script to make it more readable. The following lines are equivalent:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;name="Hege"&lt;/pre&gt;&lt;pre&gt;name = "Hege"&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Break up a Code Line&lt;/h2&gt;  &lt;p&gt;You can break up a code line &lt;b&gt;within a text string&lt;/b&gt; with a backslash. The example below will be displayed properly:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;document.write("Hello \&lt;/pre&gt;&lt;pre&gt;World!")&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;However, you cannot break up a code line like this:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;document.write \&lt;/pre&gt;&lt;pre&gt;("Hello World!")&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Comments&lt;/h2&gt;  &lt;p&gt;You can add comments to your script by using two slashes //:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;//this is a comment&lt;/pre&gt;&lt;pre&gt;document.write("Hello World!")&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;or by using /* and */ (this creates a multi-line comment block):&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;/* This is a comment&lt;/pre&gt;&lt;pre&gt;block. It contains&lt;/pre&gt;&lt;pre&gt;several lines */&lt;/pre&gt;&lt;pre&gt;document.write("Hello World!")&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;p class="intro"&gt;JavaScript is an Object Oriented Programming (OOP) language. &lt;/p&gt;  &lt;p class="intro"&gt;An OOP language allows you to define your own objects and make your own variable types.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Object Oriented Programming&lt;/h2&gt;  &lt;p&gt;JavaScript is an Object Oriented Programming (OOP) language. An OOP language allows you to define your own objects and make your own variable types.&lt;/p&gt;  &lt;p&gt;However, creating your own objects will be explained later, in the Advanced JavaScript section. We will start by looking at the built-in JavaScript objects, and how they are used. The next pages will explain each built-in JavaScript object in detail.&lt;/p&gt;  &lt;p&gt;Note that an object is just a special kind of data. An object has properties and methods.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Properties&lt;/h2&gt;  &lt;p&gt;Properties are the values associated with an object.&lt;/p&gt;  &lt;p&gt;In the following example we are using the length property of the String object to return the number of characters in a string:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;script type="text/javascript"&gt;&lt;/pre&gt;&lt;pre&gt;var txt="Hello World!"&lt;/pre&gt;&lt;pre&gt;document.write(txt.length)&lt;/pre&gt;&lt;pre&gt;&lt;/script&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The output of the code above will be:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;12&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Methods&lt;/h2&gt;  &lt;p&gt;Methods are the actions that can be performed on objects.&lt;/p&gt;  &lt;p&gt;In the following example we are using the toUpperCase() method of the String object to display a text in uppercase letters:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;script type="text/javascript"&gt;&lt;/pre&gt;&lt;pre&gt;var str="Hello world!"&lt;/pre&gt;&lt;pre&gt;document.write(str.toUpperCase())&lt;/pre&gt;&lt;pre&gt;&lt;/script&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The output of the code above will be:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;HELLO WORLD!&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Examples&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_length_string" target="_blank"&gt;Return the length of a string&lt;/a&gt;&lt;br /&gt;How to use the length property to find the length of a string.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_str_style" target="_blank"&gt;Style strings&lt;/a&gt;&lt;br /&gt;How to style strings.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_indexof" target="_blank"&gt;The indexOf() method&lt;/a&gt;&lt;br /&gt;How to use the indexOf() method to return the position of the first occurrence of a specified string value in a string.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_match" target="_blank"&gt;The match() method&lt;/a&gt;&lt;br /&gt;How to use the match() method to search for a specified string value within a string and return the string value if found&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_replace" target="_blank"&gt;Replace characters in a string - replace()&lt;/a&gt;&lt;br /&gt;How to use the replace() method to replace some characters with some other characters in a string.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Tip:&lt;/b&gt; You will find a lot more examples in the &lt;b&gt;String object reference&lt;/b&gt; - look at the bottom of this page!&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;String object&lt;/h2&gt;  &lt;p&gt;The String object is used to manipulate a stored piece of text.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Examples of use:&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;The following example uses the length property of the String object to find the length of a string:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;var txt="Hello world!"&lt;/pre&gt;&lt;pre&gt;document.write(txt.length)&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The code above will result in the following output:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;12&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The following example uses the toUpperCase() method of the String object to convert a string to uppercase letters:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;var txt="Hello world!"&lt;/pre&gt;&lt;pre&gt;document.write(txt.toUpperCase())&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The code above will result in the following output:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;HELLO WORLD!&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Complete String Object Reference&lt;/h2&gt;  &lt;p&gt;For a complete reference of all the properties and methods that can be used with the String object, go to our &lt;a href="http://www.w3schools.com/jsref/jsref_obj_string.asp"&gt;complete String object reference&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;The reference contains a brief description and examples of use for each property and method!&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;p class="intro"&gt;The Date object is used to work with dates and times.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Examples&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_date" target="_blank"&gt;Return today's date and time&lt;/a&gt;&lt;br /&gt;How to use the Date() method to get today's date.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_gettime" target="_blank"&gt;getTime()&lt;/a&gt;&lt;br /&gt;Use getTime() to calculate the years since 1970.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_setfullyear2" target="_blank"&gt;setFullYear()&lt;/a&gt;&lt;br /&gt;How to use setFullYear() to set a specific date.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_toutcstring" target="_blank"&gt;toUTCString()&lt;/a&gt;&lt;br /&gt;How to use toUTCString() to convert today's date (according to UTC) to a string.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_date_weekday" target="_blank"&gt;getDay()&lt;/a&gt;&lt;br /&gt;Use getDay() and an array to write a weekday, and not just a number.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_timing_clock" target="_blank"&gt;Display a clock&lt;/a&gt;&lt;br /&gt;How to display a clock on your web page.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Tip:&lt;/b&gt; You will find a lot more examples in the &lt;b&gt;Date object reference&lt;/b&gt; - look at the bottom of this page!&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Defining Dates&lt;/h2&gt;  &lt;p&gt;The Date object is used to work with dates and times. &lt;/p&gt;  &lt;p&gt;We define a Date object with the new keyword. The following code line defines a Date object called myDate:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;var myDate=new Date()&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; The Date object will automatically hold the current date and time as its initial value!&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Manipulate Dates&lt;/h2&gt;  &lt;p&gt;We can easily manipulate the date by using the methods available for the Date object.&lt;/p&gt;  &lt;p&gt;In the example below we set a Date object to a specific date (&lt;st1:date year="2010" day="14" month="1" st="on"&gt;14th January 2010&lt;/st1:date&gt;):&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;var myDate=new Date()&lt;/pre&gt;&lt;pre&gt;myDate.setFullYear(2010,0,14)&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;And in the following example we set a Date object to be 5 days into the future:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;var myDate=new Date()&lt;/pre&gt;&lt;pre&gt;myDate.setDate(myDate.getDate()+5)&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; If adding five days to a date shifts the month or year, the changes are handled automatically by the Date object itself!&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Comparing Dates&lt;/h2&gt;  &lt;p&gt;The Date object is also used to compare two dates.&lt;/p&gt;  &lt;p&gt;The following example compares today's date with &lt;st1:date year="2010" day="14" month="1" st="on"&gt;the 14th January 2010&lt;/st1:date&gt;:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;var myDate=new Date()&lt;/pre&gt;&lt;pre&gt;myDate.setFullYear(2010,0,14)&lt;/pre&gt;&lt;pre&gt;var today = new Date()&lt;/pre&gt;&lt;pre&gt;if (myDate&gt;today)&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;alert("Today is before &lt;st1:date year="2010" day="14" month="1" st="on"&gt;14th January 2010&lt;/st1:date&gt;")&lt;/pre&gt;&lt;pre&gt;else&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;alert("Today is after &lt;st1:date year="2010" day="14" month="1" st="on"&gt;14th January 2010&lt;/st1:date&gt;")&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Complete Date Object Reference&lt;/h2&gt;  &lt;p&gt;For a complete reference of all the properties and methods that can be used with the Date object, go to our &lt;a href="http://www.w3schools.com/jsref/jsref_obj_date.asp"&gt;complete Date object reference&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;The reference contains a brief description and examples of use for each property and method!&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;p class="intro"&gt;The Array object is used to store a set of values in a single variable name.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Examples&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_array" target="_blank"&gt;Create an array&lt;/a&gt;&lt;br /&gt;Create an array, assign values to it, and write the values to the output.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_array_for_in" target="_blank"&gt;For...In Statement&lt;/a&gt;&lt;br /&gt;How to use a for...in statement to loop through the elements of an array.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_concat" target="_blank"&gt;Join two arrays - concat()&lt;/a&gt;&lt;br /&gt;How to use the concat() method to join two arrays. &lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_join" target="_blank"&gt;Put array elements into a string - join()&lt;/a&gt;&lt;br /&gt;How to use the join() method to put all the elements of an array into a string.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_sort" target="_blank"&gt;Literal array - sort()&lt;/a&gt;&lt;br /&gt;How to use the sort() method to sort a literal array.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_sort2" target="_blank"&gt;Numeric array - sort()&lt;/a&gt;&lt;br /&gt;How to use the sort() method to sort a numeric array.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Tip:&lt;/b&gt; You will find a lot more examples in the &lt;b&gt;Array object reference&lt;/b&gt; - look at the bottom of this page!&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Defining Arrays&lt;/h2&gt;  &lt;p&gt;The Array object is used to store a set of values in a single variable name.&lt;/p&gt;  &lt;p&gt;We define an Array object with the new keyword. The following code line defines an Array object called myArray:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;var myArray=new Array()&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;There are two ways of adding values to an array (you can add as many values as you need to define as many variables you require).&lt;/p&gt;  &lt;p&gt;1:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;var mycars=new Array()&lt;/pre&gt;&lt;pre&gt;mycars[0]="Saab"&lt;/pre&gt;&lt;pre&gt;mycars[1]="Volvo"&lt;/pre&gt;&lt;pre&gt;mycars[2]="BMW"&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;You could also pass an integer argument to control the array's size:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;var mycars=new Array(3)&lt;/pre&gt;&lt;pre&gt;mycars[0]="Saab"&lt;/pre&gt;&lt;pre&gt;mycars[1]="Volvo"&lt;/pre&gt;&lt;pre&gt;mycars[2]="BMW"&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;2:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;var mycars=new Array("Saab","Volvo","BMW")&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; If you specify numbers or true/false values inside the array then the type of variables will be numeric or Boolean instead of string.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Accessing Arrays&lt;/h2&gt;  &lt;p&gt;You can refer to a particular element in an array by referring to the name of the array and the index number. The index number starts at 0.&lt;/p&gt;  &lt;p&gt;The following code line:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;document.write(mycars[0])&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;will result in the following output:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;Saab&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Modify Values in Existing Arrays&lt;/h2&gt;  &lt;p&gt;To modify a value in an existing array, just add a new value to the array with a specified index number:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;mycars[0]="Opel"&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;Now, the following code line:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;document.write(mycars[0])&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;will result in the following output:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;Opel&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Complete Array Object Reference&lt;/h2&gt;  &lt;p&gt;For a complete reference of all the properties and methods that can be used with the Array object, go to our &lt;a href="http://www.w3schools.com/jsref/jsref_obj_array.asp"&gt;complete Array object reference&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;The reference contains a brief description and examples of use for each property and method!&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;p class="intro"&gt;The Boolean object is used to convert a non-Boolean value to a Boolean value (true or false).&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Examples&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_boolean" target="_blank"&gt;Check Boolean value&lt;/a&gt;&lt;br /&gt;Check if a Boolean object is true or false.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Tip:&lt;/b&gt; You will find more examples in the &lt;b&gt;Boolean object reference&lt;/b&gt; - look at the bottom of this page!&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Boolean Object&lt;/h2&gt;  &lt;p&gt;The Boolean object is an object wrapper for a Boolean value.&lt;/p&gt;  &lt;p&gt;The Boolean object is used to convert a non-Boolean value to a Boolean value (true or false).&lt;/p&gt;  &lt;p&gt;We define a Boolean object with the new keyword. The following code line defines a Boolean object called myBoolean:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;var myBoolean=new Boolean()&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; If the Boolean object has no initial value or if it is 0, -0, null, "", false, undefined, or &lt;st1:place st="on"&gt;NaN&lt;/st1:place&gt;, the object is set to false. Otherwise it is true (even with the string "false")!&lt;/p&gt;  &lt;p&gt;All the following lines of code create Boolean objects with an initial value of false:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;var myBoolean=new Boolean()&lt;/pre&gt;&lt;pre&gt;var myBoolean=new Boolean(0)&lt;/pre&gt;&lt;pre&gt;var myBoolean=new Boolean(null)&lt;/pre&gt;&lt;pre&gt;var myBoolean=new Boolean("")&lt;/pre&gt;&lt;pre&gt;var myBoolean=new Boolean(false)&lt;/pre&gt;&lt;pre&gt;var myBoolean=new Boolean(&lt;st1:place st="on"&gt;NaN&lt;/st1:place&gt;)&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;And all the following lines of code create Boolean objects with an initial value of true:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;var myBoolean=new Boolean(true)&lt;/pre&gt;&lt;pre&gt;var myBoolean=new Boolean("true")&lt;/pre&gt;&lt;pre&gt;var myBoolean=new Boolean("false")&lt;/pre&gt;&lt;pre&gt;var myBoolean=new Boolean("Richard")&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Complete Boolean Object Reference&lt;/h2&gt;  &lt;p&gt;For a complete reference of all the properties and methods that can be used with the Boolean object, go to our &lt;a href="http://www.w3schools.com/jsref/jsref_obj_boolean.asp"&gt;complete Boolean object reference&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;The reference contains a brief description and examples of use for each property and method!&lt;/p&gt;  &lt;p class="intro"&gt;The Math object allows you to perform common mathematical tasks.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Examples&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_round" target="_blank"&gt;round()&lt;/a&gt;&lt;br /&gt;How to use round().&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_random" target="_blank"&gt;random()&lt;/a&gt;&lt;br /&gt;How to use random() to return a random number between 0 and 1.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_max" target="_blank"&gt;max()&lt;/a&gt;&lt;br /&gt;How to use max() to return the number with the highest value of two specified numbers.&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/jsref/tryit.asp?filename=tryjsref_min" target="_blank"&gt;min()&lt;/a&gt;&lt;br /&gt;How to use min() to return the number with the lowest value of two specified numbers.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Tip:&lt;/b&gt; You will find a lot more examples in the &lt;b&gt;Math object reference&lt;/b&gt; - look at the bottom of this page!&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Math Object&lt;/h2&gt;  &lt;p&gt;The Math object allows you to perform common mathematical tasks.&lt;/p&gt;  &lt;p&gt;The Math object includes several mathematical values and functions. You do not need to define the Math object before using it.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Mathematical Values&lt;/h2&gt;  &lt;p&gt;JavaScript provides eight mathematical values (constants) that can be accessed from the Math object. These are: E, PI, square root of 2, square root of 1/2, natural log of 2, natural log of 10, base-2 log of E, and base-10 log of E.&lt;/p&gt;  &lt;p&gt;You may reference these values from your JavaScript like this:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;Math.E&lt;/pre&gt;&lt;pre&gt;Math.PI&lt;/pre&gt;&lt;pre&gt;Math.SQRT2&lt;/pre&gt;&lt;pre&gt;&lt;span style="" lang="FR"&gt;Math.SQRT1_2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="" lang="FR"&gt;Math.LN2&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="" lang="FR"&gt;Math.LN10&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;Math.LOG2E&lt;/pre&gt;&lt;pre&gt;Math.LOG10E&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Mathematical Methods&lt;/h2&gt;  &lt;p&gt;In addition to the mathematical values that can be accessed from the Math object there are also several functions (methods) available.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;Examples of functions (methods):&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;The following example uses the round() method of the Math object to round a number to the nearest integer:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;document.write(Math.round(4.7))&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The code above will result in the following output:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;5&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The following example uses the random() method of the Math object to return a random number between 0 and 1:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;document.write(Math.random())&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The code above can result in the following output:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;script type="text/javascript"&gt; 	document.write(Math.random())   &lt;/script&gt;0.9425462674836698&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The following example uses the floor() and random() methods of the Math object to return a random number between 0 and 10:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;document.write(Math.floor(Math.random()*11))&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The code above can result in the following output:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;script type="text/javascript"&gt; 	document.write(Math.floor(Math.random()*11))   &lt;/script&gt;9&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Complete Math Object Reference&lt;/h2&gt;  &lt;p&gt;For a complete reference of all the properties and methods that can be used with the Math object, go to our &lt;a href="http://www.w3schools.com/jsref/jsref_obj_math.asp"&gt;complete Math object reference&lt;/a&gt;.&lt;/p&gt;  &lt;p&gt;The reference contains a brief description and examples of use for each property and method!&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;p class="intro"&gt;In addition to the built-in JavaScript objects, you can also access and manipulate all of the HTML DOM objects with JavaScript.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;The HTML DOM&lt;/h2&gt;  &lt;p&gt;The HTML DOM is a W3C standard and it is an abbreviation for the Document Object Model for HTML. &lt;/p&gt;  &lt;p&gt;The HTML DOM defines a standard set of objects for HTML, and a standard way to access and manipulate HTML documents.&lt;/p&gt;  &lt;p&gt;All HTML elements, along with their containing text and attributes, can be accessed through the DOM. The contents can be modified or deleted, and new elements can be created.&lt;/p&gt;  &lt;p&gt;The HTML DOM is platform and language independent. It can be used by any programming language like Java, JavaScript, and VBScript.&lt;/p&gt;  &lt;p&gt;Follow the links below to learn more about how to access and manipulate each DOM object with JavaScript:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt; width: 25%;" width="25%"&gt;   &lt;p class="MsoNormal"&gt;&lt;b&gt;Object&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt; width: 75%;" width="75%"&gt;   &lt;p class="MsoNormal"&gt;&lt;b&gt;Description&lt;o:p&gt;&lt;/o:p&gt;&lt;/b&gt;&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_anchor.asp"&gt;Anchor&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Represents an HTML a element (a hyperlink)&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_applet.asp"&gt;Applet&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Represents an HTML applet element. The applet element is   used to place executable content on a page&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_area.asp"&gt;Area&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Represents an area of an image-map. An image-map is an   image with clickable regions&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_base.asp"&gt;Base&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Represents an HTML base element&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_basefont.asp"&gt;Basefont&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Represents an HTML basefont element&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_body.asp"&gt;Body&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Represents the body of the document (the HTML body)&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_button.asp"&gt;Button&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Represents a push button on an HTML form. For each instance   of an HTML &lt;input type="button"&gt; tag on an HTML form, a   Button object is created&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_checkbox.asp"&gt;Checkbox&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Represents a checkbox on an HTML form. For each instance   of an HTML &lt;input type="checkbox"&gt; tag on an HTML form, a   Checkbox object is created&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_document.asp"&gt;Document&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Used to access all elements in a page&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_event.asp"&gt;Event&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Represents the state of an event, such as the element in   which the event occurred, the state of the keyboard keys, the location of the   mouse, and the state of the mouse buttons&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_fileupload.asp"&gt;FileUpload&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;For each instance of an HTML &lt;input type="file"&gt; tag on a form, a FileUpload object is created&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_form.asp"&gt;Form&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Forms are used to prompt users for input. Represents an   HTML form element&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_frame.asp"&gt;Frame&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Represents an HTML frame&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_frameset.asp"&gt;Frameset&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Represents an HTML frameset&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_hidden.asp"&gt;Hidden&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Represents a hidden field on an HTML form. For each   instance of an HTML &lt;input type="hidden"&gt; tag on a form, a   Hidden object is created&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_history.asp"&gt;History&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;A predefined object which can be accessed through the   history property of the Window object. This object consists of an array of   URLs. These URLs are all the URLs the user has visited within a browser   window&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_iframe.asp"&gt;Iframe&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Represents an HTML inline-frame&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_image.asp"&gt;Image&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Represents an HTML img element&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_link.asp"&gt;Link&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Represents an HTML link element. The link element can only   be used within the &lt;head&gt; tag&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_location.asp"&gt;Location&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Contains information about the current URL&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_meta.asp"&gt;Meta&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Represents an HTML meta element&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_navigator.asp"&gt;Navigator&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Contains information about the client browser&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_option.asp"&gt;Option&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Represents an option in a selection list on an HTML form.   For each instance of an HTML &lt;option&gt; tag in a selection list on a   form, an Option object is created&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_password.asp"&gt;Password&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Represents a password field on an HTML form. For each   instance of an HTML &lt;input type="password"&gt; tag on a form, a   Password object is created&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_radio.asp"&gt;Radio&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Represents radio buttons on an HTML form. For each   instance of an HTML &lt;input type="radio"&gt; tag on a form, a   Radio object is created&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_reset.asp"&gt;Reset&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Represents a reset button on an HTML form. For each   instance of an HTML &lt;input type="reset"&gt; tag on a form, a   Reset object is created&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_screen.asp"&gt;Screen&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Automatically created by the JavaScript runtime engine and   it contains information about the client's display screen&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_select.asp"&gt;Select&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Represents a selection list on an HTML form. For each   instance of an HTML &lt;select&gt; tag on a form, a Select object is created&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_style.asp"&gt;Style&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Represents an individual style statement. This object can   be accessed from the document or from the elements to which that style is   applied&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_submit.asp"&gt;Submit&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Represents a submit button on an HTML form. For each   instance of an HTML &lt;input type="submit"&gt; tag on a form, a   Submit object is created&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_table.asp"&gt;Table&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Represents an HTML table element&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_tabledata.asp"&gt;TableData&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Represents an HTML td element&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_tableheader.asp"&gt;TableHeader&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Represents an HTML th element&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_tablerow.asp"&gt;TableRow&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Represents an HTML tr element&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_text.asp"&gt;Text&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Represents a text field on an HTML form. For each instance   of an HTML &lt;input type="text"&gt; tag on a form, a Text object   is created&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_textarea.asp"&gt;Textarea&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Represents an HTML textarea element&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt;  &lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;&lt;a href="http://www.w3schools.com/htmldom/dom_obj_window.asp"&gt;Window&lt;/a&gt;&lt;/p&gt;   &lt;/td&gt;   &lt;td style="padding: 0.75pt;" valign="top"&gt;   &lt;p class="MsoNormal"&gt;Corresponds to the browser window. A Window object is   created automatically with every instance of a &lt;body&gt; or   &lt;frameset&gt; tag&lt;/p&gt;   &lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;p class="intro"&gt;The JavaScript Navigator object contains information about the visitor's browser.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Examples&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_browser" target="_blank"&gt;Detect the visitor's browser and browser version&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_browserdetails" target="_blank"&gt;More details about the visitor's browser&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=try_dom_navigator" target="_blank"&gt;All details about the visitor's browser&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_browser2" target="_blank"&gt;Alert user, depending on browser&lt;/a&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Browser Detection&lt;/h2&gt;  &lt;p&gt;Almost everything in this tutorial works on all JavaScript-enabled browsers. However, there are some things that just don't work on certain browsers - specially on older browsers.&lt;/p&gt;  &lt;p&gt;So, sometimes it can be very useful to detect the visitor's browser type and version, and then serve up the appropriate information.&lt;/p&gt;  &lt;p&gt;The best way to do this is to make your web pages smart enough to look one way to some browsers and another way to other browsers.&lt;/p&gt;  &lt;p&gt;JavaScript includes an object called the Navigator object, that can be used for this purpose.&lt;/p&gt;  &lt;p&gt;The Navigator object contains information about the visitor's browser name, browser version, and more.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;The Navigator Object&lt;/h2&gt;  &lt;p&gt;The JavaScript Navigator object contains all information about the visitor's browser. We are going to look at two properties of the Navigator object:&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;appName -  holds the      name of the browser &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;appVersion - holds, among      other things, the version of the browser &lt;/li&gt;&lt;/ul&gt;  &lt;h3&gt;Example&lt;/h3&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;html&gt;&lt;/pre&gt;&lt;pre&gt;&lt;body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;script type="text/javascript"&gt;&lt;/pre&gt;&lt;pre&gt;var browser=navigator.appName&lt;/pre&gt;&lt;pre&gt;var b_version=navigator.appVersion&lt;/pre&gt;&lt;pre&gt;var version=parseFloat(b_version)&lt;/pre&gt;&lt;pre&gt;document.write("Browser name: "+ browser)&lt;/pre&gt;&lt;pre&gt;document.write("&lt;br /&gt;")&lt;/pre&gt;&lt;pre&gt;&lt;span style="" lang="FR"&gt;document.write("Browser version: "+ version)&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="" lang="FR"&gt;&lt;/script&gt;&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/html&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The variable browser in the example above holds the name of the browser, i.e. "Netscape" or "Microsoft Internet Explorer".&lt;/p&gt;  &lt;p&gt;The appVersion property in the example above returns a string that contains much more information than just the version number, but for now we are only interested in the version number. To pull the version number out of the string we are using a function called parseFloat(), which pulls the first thing that looks like a decimal number out of a string and returns it.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;IMPORTANT!&lt;/b&gt; The version number is WRONG in IE 5.0 or later! Microsoft starts the appVersion string with the number 4.0. in IE 5.0 and IE 6.0!!! Why did they do that??? However, JavaScript is the same in IE6, IE5 and IE4, so for most scripts it is ok.&lt;/p&gt;  &lt;h3&gt;Example&lt;/h3&gt;  &lt;p&gt;The script below displays a different alert, depending on the visitor's browser:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;html&gt;&lt;/pre&gt;&lt;pre&gt;&lt;head&gt;&lt;/pre&gt;&lt;pre&gt;&lt;script type="text/javascript"&gt;&lt;/pre&gt;&lt;pre&gt;function detectBrowser()&lt;br /&gt;{&lt;br /&gt;var browser=navigator.appName&lt;/pre&gt;&lt;pre&gt;var b_version=navigator.appVersion&lt;/pre&gt;&lt;pre&gt;var version=parseFloat(b_version)&lt;/pre&gt;&lt;pre&gt;if ((browser=="Netscape"||browser=="Microsoft Internet Explorer")&lt;/pre&gt;&lt;pre&gt;&amp;amp;&amp;amp; (version&gt;=4))&lt;br /&gt;&lt;span style=""&gt;  &lt;/span&gt;{alert("Your browser is good enough!")}&lt;/pre&gt;&lt;pre&gt;else&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;{alert("It's time to upgrade your browser!")}&lt;br /&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;/script&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/head&gt;&lt;/pre&gt;&lt;pre&gt;&lt;body onload="detectBrowser()"&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/html&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;p class="intro"&gt;A cookie is often used to identify a user.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Examples&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_cookie_username" target="_blank"&gt;Create a welcome cookie&lt;/a&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;What is a Cookie? &lt;/h2&gt;  &lt;p&gt;A cookie is a variable that is stored on the visitor's computer. Each time the same computer requests a page with a browser, it will send the cookie too. With JavaScript, you can both create and retrieve cookie values.&lt;/p&gt;  &lt;p&gt;Examples of cookies:&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;Name cookie - The first      time a visitor arrives to your web page, he or she must fill in her/his      name. The name is then stored in a cookie. Next time the visitor arrives      at your page, he or she could get a welcome message like "Welcome      John Doe!" The name is retrieved from the stored cookie &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;Password cookie - The first      time a visitor arrives to your web page, he or she must fill in a      password. The password is then stored in a cookie. Next time the visitor      arrives at your page, the password is retrieved from the cookie &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;Date cookie - The first      time a visitor arrives to your web page, the current date is stored in a      cookie. Next time the visitor arrives at your page, he or she could get a      message like "Your last visit was on &lt;st1:date year="2005" day="11" month="8" st="on"&gt;Tuesday August 11, 2005&lt;/st1:date&gt;!" The date is      retrieved from the stored cookie &lt;/li&gt;&lt;/ul&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Create and Store a Cookie&lt;/h2&gt;  &lt;p&gt;In this example we will create a cookie that stores the name of a visitor. The first time a visitor arrives to the web page, he or she will be asked to  fill in her/his name. The name is then stored in a cookie. The next time the visitor arrives at the same page, he or she will get welcome message.&lt;/p&gt;  &lt;p&gt;First, we create a function that stores the name of the visitor in a cookie variable:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;function setCookie(c_name,value,expiredays)&lt;/pre&gt;&lt;pre&gt;{&lt;br /&gt;var exdate=new Date()&lt;br /&gt;exdate.setDate(exdate.getDate()+expiredays)&lt;/pre&gt;&lt;pre&gt;document.cookie=c_name+ "=" +escape(value)+&lt;/pre&gt;&lt;pre&gt;((expiredays==null) ? "" : ";expires="+exdate)&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The parameters of the function above hold the name of the cookie, the value of the cookie, and the number of days until the cookie expires.&lt;/p&gt;  &lt;p&gt;In the function above we first convert the number of days to a valid date, then we add the number of days until the cookie should expire. After that we store the cookie name, cookie value and the expiration date in the document.cookie object.&lt;/p&gt;  &lt;p&gt;Then, we create another function that checks if the cookie has been set:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;function getCookie(c_name)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;if (document.cookie.length&gt;0)&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;c_start=document.cookie.indexOf(c_name + "=")&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;if (c_start!=-1)&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;    &lt;/span&gt;{ &lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;    &lt;/span&gt;c_start=c_start + c_name.length+1 &lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;    &lt;/span&gt;c_end=document.cookie.indexOf(";",c_start)&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;    &lt;/span&gt;if (c_end==-1) c_end=document.cookie.length&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;    &lt;/span&gt;return unescape(document.cookie.substring(c_start,c_end))&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;    &lt;/span&gt;} &lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;return null&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The function above first checks if a cookie is stored at all in the document.cookie object. If the document.cookie object holds some cookies, then check to see if our specific cookie is stored. If our cookie is found, then return the value, if not - return null.&lt;/p&gt;  &lt;p&gt;Last, we create the function that displays a welcome message if the cookie is set, and if the cookie is not set it will display a prompt box, asking for the name of the user:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;function checkCookie()&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;username=getCookie('username')&lt;/pre&gt;&lt;pre&gt;if (username!=null)&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;{alert('Welcome again '+username+'!')}&lt;/pre&gt;&lt;pre&gt;else &lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;username=prompt('Please enter your name:',"")&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;if (username!=null||username!="")&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;    &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;    &lt;/span&gt;setCookie('username',username,365)&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;    &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;All together now:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;html&gt;&lt;/pre&gt;&lt;pre&gt;&lt;head&gt;&lt;/pre&gt;&lt;pre&gt;&lt;script type="text/javascript"&gt;&lt;/pre&gt;&lt;pre&gt;function getCookie(c_name)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;if (document.cookie.length&gt;0)&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;c_start=document.cookie.indexOf(c_name + "=")&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;if (c_start!=-1)&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;    &lt;/span&gt;{ &lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;    &lt;/span&gt;c_start=c_start + c_name.length+1 &lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;    &lt;/span&gt;c_end=document.cookie.indexOf(";",c_start)&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;    &lt;/span&gt;if (c_end==-1) c_end=document.cookie.length&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;    &lt;/span&gt;return unescape(document.cookie.substring(c_start,c_end))&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;    &lt;/span&gt;} &lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;return null&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;function setCookie(c_name,value,expiredays)&lt;/pre&gt;&lt;pre&gt;{&lt;br /&gt;var exdate=new Date()&lt;br /&gt;exdate.setDate(exdate.getDate()+expiredays)&lt;/pre&gt;&lt;pre&gt;document.cookie=c_name+ "=" +escape(value)+&lt;/pre&gt;&lt;pre&gt;((expiredays==null) ? "" : ";expires="+exdate)&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;function checkCookie()&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;username=getCookie('username')&lt;/pre&gt;&lt;pre&gt;if (username!=null)&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;{alert('Welcome again '+username+'!')}&lt;/pre&gt;&lt;pre&gt;else &lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;username=prompt('Please enter your name:',"")&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;if (username!=null||username!="")&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;    &lt;/span&gt;{&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;    &lt;/span&gt;setCookie('username',username,365)&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;    &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;}&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;/script&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/head&gt;&lt;/pre&gt;&lt;pre&gt;&lt;body onload="checkCookie()"&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/html&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The example above runs the checkCookie() function when the page loads.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;p class="intro"&gt;JavaScript can be used to validate input data in HTML forms before sending off the content to a server.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;JavaScript Form Validation&lt;/h2&gt;  &lt;p&gt;JavaScript can be used to validate input data in HTML forms before sending off the content to a server.&lt;/p&gt;  &lt;p&gt;Form data that typically are checked by a JavaScript could be:&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;has the user left required      fields empty? &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;has the user entered a valid      e-mail address? &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;has the user entered a valid      date? &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;has the user entered text in      a numeric field? &lt;/li&gt;&lt;/ul&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Required Fields&lt;/h2&gt;  &lt;p&gt;The function below checks if a required field has been left empty. If the required field is blank, an alert box alerts a message and the function returns false. If a value is entered, the function returns true (means that data is OK):&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;function validate_required(field,alerttxt)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;with (field)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;if (value==null||value=="")&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;{alert(alerttxt);return false}&lt;/pre&gt;&lt;pre&gt;else {return true}&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The entire script, with the HTML form could look something like this:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;html&gt;&lt;/pre&gt;&lt;pre&gt;&lt;head&gt;&lt;/pre&gt;&lt;pre&gt;&lt;script type="text/javascript"&gt;&lt;/pre&gt;&lt;pre&gt;function validate_required(field,alerttxt)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;with (field)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;if (value==null||value=="")&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;{alert(alerttxt);return false}&lt;/pre&gt;&lt;pre&gt;else {return true}&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;function validate_form(thisform)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;with (thisform)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;if (validate_required(email,"Email must be filled out!")==false)&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;{email.focus();return false}&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;/script&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/head&gt;&lt;/pre&gt;&lt;pre&gt;&lt;body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;form action="submitpage.htm"&gt;&lt;pre&gt;onsubmit="return validate_form(this)"&lt;/pre&gt;&lt;pre&gt;method="post"&gt;&lt;/pre&gt;&lt;pre&gt;Email: &lt;input type="text" name="email" size="30"&gt;&lt;/pre&gt;&lt;pre&gt;&lt;input type="submit" value="Submit"&gt; &lt;/pre&gt;&lt;pre&gt;&lt;/form&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/html&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;E-mail Validation&lt;/h2&gt;  &lt;p&gt;The function below checks if the content has the general syntax of an email.&lt;/p&gt;  &lt;p&gt;This means that the input data must contain at least an @ sign and a dot (.). Also, the @ must not be the first character of the email address, and the last dot must at least be one character after the @ sign:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;function validate_email(field,alerttxt)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;with (field)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;apos=value.indexOf("@")&lt;/pre&gt;&lt;pre&gt;&lt;span style="" lang="ES"&gt;dotpos=value.lastIndexOf(".")&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="" lang="ES"&gt;if (apos&lt;1||dotpos-apos&lt;2)&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="" lang="ES"&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;/span&gt;{alert(alerttxt);return false}&lt;/pre&gt;&lt;pre&gt;else {return true}&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The entire script, with the HTML form could look something like this:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;html&gt;&lt;/pre&gt;&lt;pre&gt;&lt;head&gt;&lt;/pre&gt;&lt;pre&gt;&lt;script type="text/javascript"&gt;&lt;/pre&gt;&lt;pre&gt;function validate_email(field,alerttxt)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;with (field)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;apos=value.indexOf("@")&lt;/pre&gt;&lt;pre&gt;&lt;span style="" lang="ES"&gt;dotpos=value.lastIndexOf(".")&lt;o:p&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="" lang="ES"&gt;if (apos&lt;1||dotpos-apos&lt;2)&gt;&lt;/o:p&gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span style="" lang="ES"&gt;&lt;span style=""&gt;  &lt;/span&gt;&lt;/span&gt;{alert(alerttxt);return false}&lt;/pre&gt;&lt;pre&gt;else {return true}&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;function validate_form(thisform)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;with (thisform)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;if (validate_email(email,"Not a valid e-mail address!")==false)&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;{email.focus();return false}&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;/script&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/head&gt;&lt;/pre&gt;&lt;pre&gt;&lt;body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;form action="submitpage.htm"&gt;&lt;pre&gt;onsubmit="return validate_form(this)"&lt;/pre&gt;&lt;pre&gt;method="post"&gt;&lt;/pre&gt;&lt;pre&gt;Email: &lt;input type="text" name="email" size="30"&gt;&lt;/pre&gt;&lt;pre&gt;&lt;input type="submit" value="Submit"&gt; &lt;/pre&gt;&lt;pre&gt;&lt;/form&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/html&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;p class="intro"&gt;With JavaScript we can create animated images.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Examples&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_animation" target="_blank"&gt;Button animation&lt;/a&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;JavaScript Animation&lt;/h2&gt;  &lt;p&gt;It is possible to use JavaScript to create animated images.&lt;/p&gt;  &lt;p&gt;The trick is to let a JavaScript change between different images on different events.&lt;/p&gt;  &lt;p&gt;In the following example we will add an image that should act as a link button on a web page. We will then add an onMouseOver event and an onMouseOut event that will run two JavaScript functions that will change between the images.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;The HTML Code&lt;/h2&gt;  &lt;p&gt;The HTML code looks like this:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;a href="http://www.w3schools.com" target="_blank"&gt;&lt;pre&gt;onmouseOver="mouseOver()"&lt;/pre&gt;&lt;pre&gt;onmouseOut="mouseOut()"&gt;&lt;/pre&gt;&lt;pre&gt;&lt;img border="0" alt="Visit W3Schools!" /&gt;&lt;pre&gt;src="b_pink.gif" name="b1" /&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/a&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;Note that we have given the image a name to make it possible for JavaScript to address it later.&lt;/p&gt;  &lt;p&gt;The onMouseOver event tells the browser that once a mouse is rolled over the image, the browser should execute a function that will replace the image with another image.&lt;/p&gt;  &lt;p&gt;The onMouseOut event tells the browser that once a mouse is rolled away from the image, another JavaScript function should be executed. This function will insert the original image again.&lt;/p&gt;  &lt;p&gt;&lt;b&gt;IMPORTANT!&lt;/b&gt; The mouse events are added to the &lt;a&gt; tag, and not to the &lt;img&gt; tag. Unfortunately, browsers do not support mouse events on images!&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;The JavaScript Code&lt;/h2&gt;  &lt;p&gt;The changing between the images is done with the following JavaScript:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;script type="text/javascript"&gt;&lt;/pre&gt;&lt;pre&gt;function mouseOver()&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;document.b1.src ="b_blue.gif"&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;function mouseOut()&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;document.b1.src ="b_pink.gif"&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;/script&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The function mouseOver() causes the image to shift to "b_blue.gif".&lt;/p&gt;  &lt;p&gt;The function mouseOut() causes the image to shift to "b_pink.gif".&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;The Entire Code&lt;/h2&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;html&gt;&lt;/pre&gt;&lt;pre&gt;&lt;head&gt;&lt;/pre&gt;&lt;pre&gt;&lt;script type="text/javascript"&gt;&lt;/pre&gt;&lt;pre&gt;function mouseOver()&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;document.b1.src ="b_blue.gif"&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;function mouseOut()&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;document.b1.src ="b_pink.gif"&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;/script&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/head&gt;&lt;/pre&gt;&lt;pre&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;a href="http://www.w3schools.com" target="_blank"&gt;&lt;pre&gt;onmouseOver="mouseOver()"&lt;/pre&gt;&lt;pre&gt;onmouseOut="mouseOut()"&gt;&lt;/pre&gt;&lt;pre&gt;&lt;img border="0" alt="Visit W3Schools!" /&gt;&lt;pre&gt;src="b_pink.gif" name="b1" /&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/a&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/html&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;p class="intro"&gt;An image-map is an image with clickable regions.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Examples&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_imagemap_simple" target="_blank"&gt;Simple HTML Image map&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_imagemap" target="_blank"&gt;Image map with added JavaScript&lt;/a&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;HTML Image Maps&lt;/h2&gt;  &lt;p&gt;From our HTML tutorial we have learned that an image-map is an image with clickable regions. Normally, each region has an associated hyperlink. Clicking on one of the regions takes you to the associated link.&lt;/p&gt;  &lt;h3&gt;Example&lt;/h3&gt;  &lt;p&gt;The example below demonstrates how to create an HTML image map, with clickable regions. Each of the regions is a hyperlink:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 2.25pt;" valign="top"&gt;&lt;pre&gt;&lt;img src ="planets.gif" /&gt;&lt;pre&gt;width ="145" height ="126"&lt;/pre&gt;&lt;pre&gt;alt="Planets"&lt;/pre&gt;&lt;pre&gt;usemap ="#planetmap" /&gt;&lt;/pre&gt;&lt;pre&gt;&lt;map id ="planetmap"&gt;&lt;pre&gt;name="planetmap"&gt;&lt;/pre&gt;&lt;pre&gt;&lt;area shape ="rect" coords ="0,0,82,126"&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;href ="sun.htm" target ="_blank"&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;alt="Sun" /&gt;&lt;/pre&gt;&lt;pre&gt;&lt;area shape ="circle" coords ="90,58,3"&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;href ="mercur.htm" target ="_blank"&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;alt="Mercury" /&gt;&lt;/pre&gt;&lt;pre&gt;&lt;area shape ="circle" coords ="124,58,8"&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;href ="venus.htm" target ="_blank"&lt;/pre&gt;&lt;pre&gt;&lt;span style=""&gt;  &lt;/span&gt;alt="Venus" /&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/map&gt; &lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;h3&gt;Result&lt;/h3&gt;  &lt;p class="MsoNormal"&gt;&lt;!--[if gte vml 1]&gt;&lt;v:group id="_x0000_s1026" style="'position:absolute;" coordsize="1980,1890"&gt;  &lt;v:oval id="_x0000_s1027" href="http://www.w3schools.com/js/venus.htm" target="_blank" style="'position:absolute;left:1740;top:750;width:240;" button="t" filled="f" stroked="f"&gt;   &lt;v:fill detectmouseclick="t"&gt;   &lt;o:lock ext="edit" aspectratio="t"&gt;  &lt;/v:oval&gt;&lt;v:oval id="_x0000_s1028" href="http://www.w3schools.com/js/mercur.htm" target="_blank" style="'position:absolute;" button="t" filled="f" stroked="f"&gt;   &lt;v:fill detectmouseclick="t"&gt;   &lt;o:lock ext="edit" aspectratio="t"&gt;  &lt;/v:oval&gt;&lt;v:rect id="_x0000_s1029" href="http://www.w3schools.com/js/sun.htm" target="_blank" style="'position:absolute;width:1230;height:1890;" button="t" filled="f" stroked="f"&gt;   &lt;v:fill detectmouseclick="t"&gt;  &lt;/v:rect&gt;&lt;w:anchorlock/&gt; &lt;/v:group&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;span style="position: absolute; z-index: 251657728; margin-left: 0px; margin-top: 0px; width: 132px; height: 126px;"&gt;&lt;map name="MicrosoftOfficeMap0"&gt;&lt;area shape="Rect" coords="0, 0, 82, 126" href="http://www.w3schools.com/js/sun.htm" target="_blank"&gt;&lt;area shape="Circle" coords="90, 58, 3" href="http://www.w3schools.com/js/mercur.htm" target="_blank"&gt;&lt;area shape="Circle" coords="124, 58, 8" href="http://www.w3schools.com/js/venus.htm" target="_blank"&gt;&lt;/map&gt;&lt;img src="file:///D:/USERPR%7E1/sshende/LOCALS%7E1/Temp/msohtmlclip1/01/clip_image002.gif" usemap="#MicrosoftOfficeMap0" shapes="_x0000_s1026 _x0000_s1027 _x0000_s1028 _x0000_s1029" border="0" width="132" height="126" /&gt;&lt;/span&gt;&lt;!--[endif]--&gt;&lt;!--[if gte vml 1]&gt;&lt;v:shape id="_x0000_i1167" type="#_x0000_t75" alt="Planets" style="'width:108.75pt;"&gt;  &lt;v:imagedata src="file:///D:\USERPR~1\sshende\LOCALS~1\Temp\msohtmlclip1\01\clip_image003.gif" href="http://www.w3schools.com/js/planets.gif"&gt; &lt;/v:shape&gt;&lt;![endif]--&gt;&lt;!--[if !vml]--&gt;&lt;img src="file:///D:/USERPR%7E1/sshende/LOCALS%7E1/Temp/msohtmlclip1/01/clip_image003.gif" alt="Planets" shapes="_x0000_i1167" border="0" width="145" height="126" /&gt;&lt;!--[endif]--&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Adding some JavaScript&lt;/h2&gt;  &lt;p&gt;We can add events (that can call a JavaScript) to the &lt;area&gt; tags inside the image map. The &lt;area&gt; tag supports the onClick, onDblClick, onMouseDown, onMouseUp, onMouseOver, onMouseMove, onMouseOut, onKeyPress, onKeyDown, onKeyUp, onFocus, and onBlur events.&lt;/p&gt;  &lt;p&gt;Here's the above example, with some JavaScript added:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 2.25pt;" valign="top"&gt;&lt;pre&gt;&lt;html&gt;&lt;/pre&gt;&lt;pre&gt;&lt;head&gt;&lt;/pre&gt;&lt;pre&gt;&lt;script type="text/javascript"&gt;&lt;/pre&gt;&lt;pre&gt;function writeText(txt)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;document.getElementById("desc").innerHTML=txt&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;/script&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/head&gt;&lt;/pre&gt;&lt;pre&gt;&lt;body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;img src="planets.gif" width="145" height="126" /&gt;&lt;pre&gt;alt="Planets" usemap="#planetmap" /&gt;&lt;/pre&gt;&lt;pre&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;map id ="planetmap" name="planetmap"&gt;&lt;/pre&gt;&lt;pre&gt;&lt;area shape ="rect" coords ="0,0,82,126"&gt;&lt;pre&gt;onMouseOver="writeText('The Sun and the gas giant&lt;/pre&gt;&lt;pre&gt;planets like Jupiter are by far the largest objects&lt;/pre&gt;&lt;pre&gt;in our Solar System.')"&lt;/pre&gt;&lt;pre&gt;href ="sun.htm" target ="_blank" alt="Sun" /&gt;&lt;/pre&gt;&lt;pre&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;area shape ="circle" coords ="90,58,3"&gt;&lt;pre&gt;onMouseOver="writeText('The planet Mercury is very&lt;/pre&gt;&lt;pre&gt;difficult to study from the Earth because it is&lt;/pre&gt;&lt;pre&gt;always so close to the Sun.')"&lt;/pre&gt;&lt;pre&gt;href ="mercur.htm" target ="_blank" alt="Mercury" /&gt;&lt;/pre&gt;&lt;pre&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;area shape ="circle" coords ="124,58,8"&gt;&lt;pre&gt;onMouseOver="writeText('Until the 1960s, Venus was&lt;/pre&gt;&lt;pre&gt;often considered a twin sister to the Earth because&lt;/pre&gt;&lt;pre&gt;Venus is the nearest planet to us, and because the&lt;/pre&gt;&lt;pre&gt;two planets seem to share many characteristics.')"&lt;/pre&gt;&lt;pre&gt;href ="venus.htm" target ="_blank" alt="Venus" /&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/map&gt; &lt;/pre&gt;&lt;pre&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;p id="desc"&gt;&lt;/p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/html&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;p class="intro"&gt;With JavaScript, it is possible to execute some code NOT immediately after a function is called, but after a specified time interval. This is called timing events.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Examples&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_timing1" target="_blank"&gt;Simple timing&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_timing2" target="_blank"&gt;Another simple timing&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_timing_infinite" target="_blank"&gt;Timing event in an infinite loop&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_timing_stop" target="_blank"&gt;Timing event in an infinite loop - with a Stop button&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_timing_clock" target="_blank"&gt;A clock created with a timing event&lt;/a&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;JavaScript Timing Events&lt;/h2&gt;  &lt;p&gt;With JavaScript, it is possible to execute some code NOT immediately after a function is called, but after a specified time interval. This is called timing events.&lt;/p&gt;  &lt;p&gt;It's very easy to time events in JavaScript. The two key methods that are used are:&lt;/p&gt;  &lt;ul type="disc"&gt;&lt;li class="MsoNormal" style=""&gt;setTimeout() - executes a      code some time in the future &lt;/li&gt;&lt;li class="MsoNormal" style=""&gt;clearTimeout() - cancels the      setTimeout() &lt;/li&gt;&lt;/ul&gt;  &lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; The setTimeout() and clearTimeout() are both methods of the HTML DOM Window object.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;setTimeout()&lt;/h2&gt;  &lt;h3&gt;Syntax&lt;/h3&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;var t=setTimeout("javascript statement",milliseconds)&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The setTimeout() method returns a value - In the statement above, the value is stored in a variable called t. If you want to cancel this setTimeout(), you can refer to it using the variable name.&lt;/p&gt;  &lt;p&gt;The first parameter of setTimeout() is a string that contains a JavaScript statement. This statement could be a statement like "alert('5 seconds!')" or a call to a function, like "alertMsg()".&lt;/p&gt;  &lt;p&gt;The second parameter indicates how many milliseconds from now you want to execute the first parameter. &lt;/p&gt;  &lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; There are 1000 milliseconds in one second.&lt;/p&gt;  &lt;h3&gt;Example&lt;/h3&gt;  &lt;p&gt;When the button is clicked in the example below, an alert box will be displayed after 5 seconds.&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;html&gt;&lt;/pre&gt;&lt;pre&gt;&lt;head&gt;&lt;/pre&gt;&lt;pre&gt;&lt;script type="text/javascript"&gt;&lt;/pre&gt;&lt;pre&gt;function timedMsg()&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;var t=setTimeout("alert('5 seconds!')",5000)&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;/script&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/head&gt;&lt;/pre&gt;&lt;pre&gt;&lt;body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;form&gt;&lt;/pre&gt;&lt;pre&gt;&lt;input type="button" value="Display timed alertbox!"&gt;&lt;pre&gt;onClick="timedMsg()"&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/form&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/html&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;h3&gt;Example - Infinite &lt;st1:place st="on"&gt;Loop&lt;/st1:place&gt;&lt;/h3&gt;  &lt;p&gt;To get a timer to work in an infinite loop, we must write a function that calls itself. In the example below, when the button is clicked, the input field will start to count (for ever), starting at 0:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;html&gt;&lt;/pre&gt;&lt;pre&gt;&lt;head&gt;&lt;/pre&gt;&lt;pre&gt;&lt;script type="text/javascript"&gt;&lt;/pre&gt;&lt;pre&gt;var c=0&lt;/pre&gt;&lt;pre&gt;var t&lt;/pre&gt;&lt;pre&gt;function timedCount()&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;document.getElementById('txt').value=c&lt;/pre&gt;&lt;pre&gt;c=c+1&lt;/pre&gt;&lt;pre&gt;t=setTimeout("timedCount()",1000)&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;/script&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/head&gt;&lt;/pre&gt;&lt;pre&gt;&lt;body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;form&gt;&lt;/pre&gt;&lt;pre&gt;&lt;input type="button" value="Start count!"&gt;&lt;pre&gt;onClick="timedCount()"&gt;&lt;/pre&gt;&lt;pre&gt;&lt;input type="text" id="txt"&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/form&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/html&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;clearTimeout()&lt;/h2&gt;  &lt;h3&gt;Syntax&lt;/h3&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;clearTimeout(setTimeout_variable)&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;h3&gt;Example&lt;/h3&gt;  &lt;p&gt;The example below is the same as the "Infinite Loop" example above. The only difference is that we have now added a "Stop Count!" button that stops the timer:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 0.75pt;"&gt;&lt;pre&gt;&lt;html&gt;&lt;/pre&gt;&lt;pre&gt;&lt;head&gt;&lt;/pre&gt;&lt;pre&gt;&lt;script type="text/javascript"&gt;&lt;/pre&gt;&lt;pre&gt;var c=0&lt;/pre&gt;&lt;pre&gt;var t&lt;/pre&gt;&lt;pre&gt;function timedCount()&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;document.getElementById('txt').value=c&lt;/pre&gt;&lt;pre&gt;c=c+1&lt;/pre&gt;&lt;pre&gt;t=setTimeout("timedCount()",1000)&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;function stopCount()&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;clearTimeout(t)&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;pre&gt;&lt;/script&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/head&gt;&lt;/pre&gt;&lt;pre&gt;&lt;body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;form&gt;&lt;/pre&gt;&lt;pre&gt;&lt;input type="button" value="Start count!"&gt;&lt;pre&gt;onClick="timedCount()"&gt;&lt;/pre&gt;&lt;pre&gt;&lt;input type="text" id="txt"&gt;&lt;/pre&gt;&lt;pre&gt;&lt;input type="button" value="Stop count!"&gt;&lt;pre&gt;onClick="stopCount()"&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/form&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/body&gt;&lt;/pre&gt;&lt;pre&gt;&lt;/html&gt;&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;p class="intro"&gt;Objects are useful to organize information.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Examples&lt;/h2&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_create_object1" target="_blank"&gt;Create a direct instance of an object&lt;/a&gt;&lt;/p&gt;  &lt;p&gt;&lt;a href="http://www.w3schools.com/js/tryit.asp?filename=tryjs_create_object2" target="_blank"&gt;Create a template for an object&lt;/a&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;JavaScript Objects&lt;/h2&gt;  &lt;p&gt;Earlier in this tutorial we have seen that JavaScript has several built-in objects, like String, Date, Array, and more. In addition to these built-in objects, you can also create your own.&lt;/p&gt;  &lt;p&gt;An object is just a special kind of data, with a collection of properties and methods.&lt;/p&gt;  &lt;p&gt;Let's illustrate with an example: A person is an object. Properties are the values associated with the object. The persons' properties include name, height, weight, age, skin tone, eye color, etc. All persons have these properties, but the values of those properties will differ from person to person. Objects also have methods. Methods are the actions that can be performed on objects. The persons' methods could be eat(), sleep(), work(), play(), etc.&lt;/p&gt;  &lt;h3&gt;Properties&lt;/h3&gt;  &lt;p&gt;The syntax for accessing a property of an object is:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 2.25pt;" valign="top"&gt;&lt;pre&gt;objName.propName&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;You can add properties to an object by simply giving it a value. Assume that the personObj already exists - you can give it properties named firstname, lastname, age, and eyecolor as follows:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 2.25pt;" valign="top"&gt;&lt;pre&gt;personObj.firstname="John"&lt;/pre&gt;&lt;pre&gt;personObj.lastname="Doe"&lt;/pre&gt;&lt;pre&gt;personObj.age=30&lt;/pre&gt;&lt;pre&gt;personObj.eyecolor="blue"&lt;/pre&gt;&lt;pre&gt;document.write(personObj.firstname)&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The code above will generate the following output:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 2.25pt;" valign="top"&gt;&lt;pre&gt;John&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;h3&gt;Methods&lt;/h3&gt;  &lt;p&gt;An object can also contain methods.&lt;/p&gt;  &lt;p&gt;You can call a method with the following syntax:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 2.25pt;" valign="top"&gt;&lt;pre&gt;objName.methodName()&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;b&gt;Note:&lt;/b&gt; Parameters required for the method can be passed between the parentheses.&lt;/p&gt;  &lt;p&gt;To call a method called sleep() for the personObj:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 2.25pt;" valign="top"&gt;&lt;pre&gt;personObj.sleep()&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;Creating Your Own Objects&lt;/h2&gt;  &lt;p&gt;There are different ways to create a new object:&lt;/p&gt;  &lt;p&gt;&lt;b&gt;1. Create a direct instance of an object&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;The following code creates an instance of an object and adds four properties to it:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 2.25pt;" valign="top"&gt;&lt;pre&gt;personObj=new Object()&lt;/pre&gt;&lt;pre&gt;personObj.firstname="John"&lt;/pre&gt;&lt;pre&gt;personObj.lastname="Doe"&lt;/pre&gt;&lt;pre&gt;personObj.age=50&lt;/pre&gt;&lt;pre&gt;personObj.eyecolor="blue"&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;Adding a method to the personObj is also simple. The following code adds a method called eat() to the personObj:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 2.25pt;" valign="top"&gt;&lt;pre&gt;personObj.eat=eat&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;&lt;b&gt;2. Create a template of an object&lt;/b&gt;&lt;/p&gt;  &lt;p&gt;The template defines the structure of an object:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 2.25pt;" valign="top"&gt;&lt;pre&gt;function person(firstname,lastname,age,eyecolor)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;this.firstname=firstname&lt;/pre&gt;&lt;pre&gt;this.lastname=lastname&lt;/pre&gt;&lt;pre&gt;this.age=age&lt;/pre&gt;&lt;pre&gt;this.eyecolor=eyecolor&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;Notice that the template is just a function. Inside the function you need to assign things to this.propertyName. The reason for all the "this" stuff in is that you're going to have more than one person at a time (which person you're dealing with must be clear). That's what "this" is: the instance of the object at hand.&lt;/p&gt;  &lt;p&gt;Once you have the template, you can create new instances of the object, like this:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 2.25pt;" valign="top"&gt;&lt;pre&gt;myFather=new person("John","Doe",50,"blue")&lt;/pre&gt;&lt;pre&gt;myMother=new person("Sally","Rally",48,"green")&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;You can also add some methods to the person object. This is also done inside the template:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 2.25pt;" valign="top"&gt;&lt;pre&gt;function person(firstname,lastname,age,eyecolor)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;this.firstname=firstname&lt;/pre&gt;&lt;pre&gt;this.lastname=lastname&lt;/pre&gt;&lt;pre&gt;this.age=age&lt;/pre&gt;&lt;pre&gt;this.eyecolor=eyecolor&lt;/pre&gt;&lt;pre&gt;this.newlastname=newlastname&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;Note that methods are just functions attached to objects. Then we will have to write the newlastname() function:&lt;/p&gt;  &lt;table class="MsoNormalTable" style="width: 100%;" border="1" cellpadding="0" cellspacing="0" width="100%"&gt;  &lt;tbody&gt;&lt;tr style=""&gt;   &lt;td style="padding: 2.25pt;" valign="top"&gt;&lt;pre&gt;function newlastname(new_lastname)&lt;/pre&gt;&lt;pre&gt;{&lt;/pre&gt;&lt;pre&gt;this.lastname=new_lastname&lt;/pre&gt;&lt;pre&gt;}&lt;/pre&gt;&lt;/td&gt;  &lt;/tr&gt; &lt;/tbody&gt;&lt;/table&gt;  &lt;p&gt;The newlastname() function defines the person's new last name and assigns that to the person. JavaScript knows which person you're talking about by using "this.". So, now you can write: myMother.newlastname("Doe").&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;h2&gt;JavaScript Summary&lt;/h2&gt;  &lt;p&gt;This tutorial has taught you how to add JavaScript to your HTML pages, to make your web site more dynamic and interactive.&lt;/p&gt;  &lt;p&gt;You have learned how to create responses to events, validate forms and how to make different scripts run in response to different scenarios.&lt;/p&gt;  &lt;p&gt;You have also learned how to create and use objects, and how to use JavaScript's built-in objects.&lt;/p&gt;  &lt;p&gt;For more information on JavaScript, please look at our &lt;a href="http://www.w3schools.com/js/js_examples.asp"&gt;JavaScript examples&lt;/a&gt; and our &lt;a href="http://www.w3schools.com/jsref/default.asp"&gt;JavaScript reference&lt;/a&gt;.&lt;/p&gt;  &lt;div class="MsoNormal" style="text-align: center;" align="center"&gt;  &lt;hr align="center" size="2" width="100%"&gt;  &lt;/div&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7722578078463485731-4287935821036494584?l=javascriptfaqs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascriptfaqs.blogspot.com/feeds/4287935821036494584/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7722578078463485731&amp;postID=4287935821036494584' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7722578078463485731/posts/default/4287935821036494584'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7722578078463485731/posts/default/4287935821036494584'/><link rel='alternate' type='text/html' href='http://javascriptfaqs.blogspot.com/2009/01/javascript-tutorial.html' title='JavaScript Tutorial'/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</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><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7722578078463485731.post-8612792966177490508</id><published>2008-10-20T00:35:00.001-07:00</published><updated>2008-12-23T21:48:13.485-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Script'/><title type='text'>Javascript Faqs</title><content type='html'>&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 12"&gt;&lt;meta name="Originator" content="Microsoft Word 12"&gt;&lt;link rel="File-List" href="file:///D:%5CUSERPR%7E1%5Csshende%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml"&gt;&lt;link rel="themeData" href="file:///D:%5CUSERPR%7E1%5Csshende%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx"&gt;&lt;link rel="colorSchemeMapping" href="file:///D:%5CUSERPR%7E1%5Csshende%5CLOCALS%7E1%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:trackmoves/&gt;   &lt;w:trackformatting/&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:donotpromoteqf/&gt;   &lt;w:lidthemeother&gt;EN-US&lt;/w:LidThemeOther&gt;   &lt;w:lidthemeasian&gt;X-NONE&lt;/w:LidThemeAsian&gt;   &lt;w:lidthemecomplexscript&gt;X-NONE&lt;/w:LidThemeComplexScript&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;    &lt;w:splitpgbreakandparamark/&gt;    &lt;w:dontvertaligncellwithsp/&gt;    &lt;w:dontbreakconstrainedforcedtables/&gt;    &lt;w:dontvertalignintxbx/&gt;    &lt;w:word11kerningpairs/&gt;    &lt;w:cachedcolbalance/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;   &lt;m:mathpr&gt;    &lt;m:mathfont val="Cambria Math"&gt;    &lt;m:brkbin val="before"&gt;    &lt;m:brkbinsub val="&amp;#45;-"&gt;    &lt;m:smallfrac val="off"&gt;    &lt;m:dispdef/&gt;    &lt;m:lmargin val="0"&gt;    &lt;m:rmargin val="0"&gt;    &lt;m:defjc val="centerGroup"&gt;    &lt;m:wrapindent val="1440"&gt;    &lt;m:intlim val="subSup"&gt;    &lt;m:narylim val="undOvr"&gt;   &lt;/m:mathPr&gt;&lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" defunhidewhenused="true" defsemihidden="true" defqformat="false" defpriority="99" latentstylecount="267"&gt;   &lt;w:lsdexception locked="false" priority="0" semihidden="false" unhidewhenused="false" qformat="true" name="Normal"&gt;   &lt;w:lsdexception locked="false" priority="9" semihidden="false" unhidewhenused="false" qformat="true" name="heading 1"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 2"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 3"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 4"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 5"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 6"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 7"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 8"&gt;   &lt;w:lsdexception locked="false" priority="9" qformat="true" name="heading 9"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 1"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 2"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 3"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 4"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 5"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 6"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 7"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 8"&gt;   &lt;w:lsdexception locked="false" priority="39" name="toc 9"&gt;   &lt;w:lsdexception locked="false" priority="35" qformat="true" name="caption"&gt;   &lt;w:lsdexception locked="false" priority="10" semihidden="false" unhidewhenused="false" qformat="true" name="Title"&gt;   &lt;w:lsdexception locked="false" priority="1" name="Default Paragraph Font"&gt;   &lt;w:lsdexception locked="false" priority="11" semihidden="false" unhidewhenused="false" qformat="true" name="Subtitle"&gt;   &lt;w:lsdexception locked="false" priority="0" semihidden="false" unhidewhenused="false" qformat="true" name="Strong"&gt;   &lt;w:lsdexception locked="false" priority="20" semihidden="false" unhidewhenused="false" qformat="true" name="Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="59" semihidden="false" unhidewhenused="false" name="Table Grid"&gt;   &lt;w:lsdexception locked="false" unhidewhenused="false" name="Placeholder Text"&gt;   &lt;w:lsdexception locked="false" priority="1" semihidden="false" unhidewhenused="false" qformat="true" name="No Spacing"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" unhidewhenused="false" name="Revision"&gt;   &lt;w:lsdexception locked="false" priority="34" semihidden="false" unhidewhenused="false" qformat="true" name="List Paragraph"&gt;   &lt;w:lsdexception locked="false" priority="29" semihidden="false" unhidewhenused="false" qformat="true" name="Quote"&gt;   &lt;w:lsdexception locked="false" priority="30" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Quote"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 1"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 2"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 3"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 4"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 5"&gt;   &lt;w:lsdexception locked="false" priority="60" semihidden="false" unhidewhenused="false" name="Light Shading Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="61" semihidden="false" unhidewhenused="false" name="Light List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="62" semihidden="false" unhidewhenused="false" name="Light Grid Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="63" semihidden="false" unhidewhenused="false" name="Medium Shading 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="64" semihidden="false" unhidewhenused="false" name="Medium Shading 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="65" semihidden="false" unhidewhenused="false" name="Medium List 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="66" semihidden="false" unhidewhenused="false" name="Medium List 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="67" semihidden="false" unhidewhenused="false" name="Medium Grid 1 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="68" semihidden="false" unhidewhenused="false" name="Medium Grid 2 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="69" semihidden="false" unhidewhenused="false" name="Medium Grid 3 Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="70" semihidden="false" unhidewhenused="false" name="Dark List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="71" semihidden="false" unhidewhenused="false" name="Colorful Shading Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="72" semihidden="false" unhidewhenused="false" name="Colorful List Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="73" semihidden="false" unhidewhenused="false" name="Colorful Grid Accent 6"&gt;   &lt;w:lsdexception locked="false" priority="19" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="21" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Emphasis"&gt;   &lt;w:lsdexception locked="false" priority="31" semihidden="false" unhidewhenused="false" qformat="true" name="Subtle Reference"&gt;   &lt;w:lsdexception locked="false" priority="32" semihidden="false" unhidewhenused="false" qformat="true" name="Intense Reference"&gt;   &lt;w:lsdexception locked="false" priority="33" semihidden="false" unhidewhenused="false" qformat="true" name="Book Title"&gt;   &lt;w:lsdexception locked="false" priority="37" name="Bibliography"&gt;   &lt;w:lsdexception locked="false" priority="39" qformat="true" name="TOC Heading"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Font Definitions */  @font-face 	{font-family:"Cambria Math"; 	panose-1:2 4 5 3 5 4 6 3 2 4; 	mso-font-charset:1; 	mso-generic-font-family:roman; 	mso-font-format:other; 	mso-font-pitch:variable; 	mso-font-signature:0 0 0 0 0 0;} @font-face 	{font-family:Verdana; 	panose-1:2 11 6 4 3 5 4 4 2 4; 	mso-font-charset:0; 	mso-generic-font-family:swiss; 	mso-font-pitch:variable; 	mso-font-signature:536871559 0 0 0 415 0;}  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-unhide:no; 	mso-style-qformat:yes; 	mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Times New Roman","serif"; 	mso-fareast-font-family:"Times New Roman";} .MsoChpDefault 	{mso-style-type:export-only; 	mso-default-props:yes; 	font-size:10.0pt; 	mso-ansi-font-size:10.0pt; 	mso-bidi-font-size:10.0pt;} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-priority:99; 	mso-style-qformat:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:11.0pt; 	font-family:"Calibri","sans-serif"; 	mso-ascii-font-family:Calibri; 	mso-ascii-theme-font:minor-latin; 	mso-fareast-font-family:"Times New Roman"; 	mso-fareast-theme-font:minor-fareast; 	mso-hansi-font-family:Calibri; 	mso-hansi-theme-font:minor-latin; 	mso-bidi-font-family:"Times New Roman"; 	mso-bidi-theme-font:minor-bidi;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;p class="MsoNormal"&gt;&lt;strong&gt;&lt;span style="font-size: 8.5pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q. What is JavaScript?&lt;/span&gt;&lt;/strong&gt;&lt;span style="font-size: 8.5pt; font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;;"&gt;&lt;br /&gt;A. JavaScript is a scripting language designed for adding interactivity to HTML pages. JavaScript is an interpreted language. This means that scripts execute without preliminary compilation, i.e. without conversion of the script text into a system-dependent machine code. The user's browser interprets the script, that is, analyzes and immediately executes it.&lt;br /&gt;&lt;br /&gt;Thus, most Internet users today have browsers that support JavaScript. That's why JavaScript is one of the most popular tools for adding interactive features to Web pages.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: How do I insert comments in JavaScript code?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;A: JavaScript supports three different types of comments:&lt;br /&gt;&lt;br /&gt;1. Multiple-line C-style comments. Everything between /* and */ is a comment,&lt;br /&gt;for example:&lt;br /&gt;/* This is a comment */&lt;br /&gt;/* C-style comments can span&lt;br /&gt;as many lines as you like,&lt;br /&gt;as shown in this example */&lt;br /&gt;&lt;br /&gt;2. One-line comments of C++ style. These comments begin with // and continue up to the next line break:&lt;br /&gt;// This is a one-line comment&lt;br /&gt;&lt;br /&gt;3. One-line comments with the HTML comment-opening sequence (&lt;!--). Note that the JavaScript interpreter ignores the closing characters of HTML comments (--&gt;). Consider this example:&lt;br /&gt;&lt;!-- This is treated as a one-line JS comment&lt;br /&gt;&lt;!-- It works just like a comment beginning with //&lt;br /&gt;&lt;!-- --&gt; This is also a one-line JS comment&lt;br /&gt;&lt;!-- --&gt; because JS ignores the closing characters&lt;br /&gt;&lt;!-- --&gt; of HTML-style comments&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: How do I hide JS code from old browsers that do not support JavaScript?&lt;/span&gt;&lt;/strong&gt;&lt;b&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;A: To prevent old browsers from displaying your JS code, do the following:&lt;br /&gt;&lt;br /&gt;1) Immediately after the opening &lt;script&gt; tag, put a one-line HTML-style comment without the closing characters, so that the first two lines of your script would look like this:&lt;br /&gt;&lt;script language="JavaScript"&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;&lt;br /&gt;2) At the end of your script, put the following two lines:&lt;br /&gt;//--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;Thus, your HTML file will contain the following fragment:&lt;br /&gt;&lt;script language="JavaScript"&gt;&lt;br /&gt;&lt;!--Here you put your JS code.&lt;br /&gt;Old browsers will treat it&lt;br /&gt;as an HTML comment.//--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: If the user's browser cannot execute JavaScript code, can I display a warning for the user?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;A: Yes, you can display a special warning for users of JavaScript-incapable browsers. Put your warning text between the tags &lt;noscript&gt; and &lt;/noscript&gt;.&lt;br /&gt;Here's an example:&lt;br /&gt;&lt;br /&gt;&lt;noscript&gt;&lt;br /&gt;&lt;h3&gt;This page uses JavaScript&lt;/h3&gt;&lt;br /&gt;&lt;ul&gt;&lt;li&gt;Please use Netscape Navigator 3+ or Internet Explorer 3+&lt;br /&gt;&lt;li&gt;Make sure that JavaScript is enabled in your browser.&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;/noscript&gt;&lt;br /&gt;&lt;br /&gt;JavaScript-enabled browsers will ignore everything between &lt;noscript&gt; and &lt;/noscript&gt;. Browsers that cannot execute JavaScript will display your message on the page.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: Can I include JavaScript code from external JS files, rather than embedding all my scripts within HTML pages?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;Answer: Yes. To do so, create a new file with the extension .js, for example, myscript.js. Put your JavaScript code in this file; do not include opening and closing SCRIPT tags in the .js file!&lt;br /&gt;&lt;br /&gt;To embed myscript.js into your Web page, use these tags in your HTML file:&lt;br /&gt;&lt;br /&gt;&lt;script language="JavaScript" src="myscript.js"&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: Can I make a button on my page work as the browser's Back button?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;A: To create your own Back button, use this code&lt;br /&gt;&lt;br /&gt;&lt;form&gt;&lt;input type="button" value="Back" onclick="history.back()"&gt; &lt;/form&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: Can I make a button on my page work as the browser's Forward button?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;A: To create your own Forward button, use this code&lt;br /&gt;&lt;br /&gt;&lt;form&gt;&lt;input type="button" value="Forward" onclick="history.forward()"&gt;&lt;/form&gt;&lt;br /&gt;&lt;br /&gt;If your browser's Forward button is currently inactive, then the Forward button on your page won't work either. This is the case when the current page is the last page in your browsing history.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: Can I pass parameters from one my page to another?&lt;/span&gt;&lt;/strong&gt;&lt;b&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;Answer: Yes, you can pass a parameter to another page in several different ways:&lt;br /&gt;&lt;br /&gt;by storing the parameter in a cookie&lt;br /&gt;by storing the parameter in a variable of another window or frame&lt;br /&gt;by storing the parameter in the rewritable property top.name (the browser window name)&lt;br /&gt;by appending the parameter to the destination page's URL as a query string&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: How do I convert strings to numbers in JavaScript?&lt;/span&gt;&lt;/strong&gt;&lt;b&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;Answer: To convert a string to a number, use the JavaScript function parseFloat (for conversion to a floating-point number) or parseInt (for conversion to an integer).&lt;br /&gt;&lt;br /&gt;parseFloat syntax: parseFloat('string')&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: Is there a way to test whether a particular variable holds a number or a string?&lt;/span&gt;&lt;/strong&gt;&lt;b&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;Answer: Yes. To test whether the variable holds a number or a string, use the typeof operator. If your variable holds a number, typeof(variable) will return "number". If it holds a string, typeof(variable) will return "string". The following are examples of typeof usage:&lt;br /&gt;&lt;br /&gt;typeof(123) // result: "number"&lt;br /&gt;typeof("123") // result: "string"&lt;br /&gt;&lt;br /&gt;if (typeof k == "string") { alert('k is a string.') }&lt;br /&gt;if (typeof k == "number") { alert('k is a number.') }&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: How do I generate random numbers in JavaScript?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;Answer: To generate random floating-point numbers in the range from 0 to 1, use the Math.random() method:&lt;br /&gt;&lt;br /&gt;num = Math.random() // num is random, from 0 to 1&lt;br /&gt;&lt;br /&gt;If you need random floating-point numbers in the range from A to B, use this code:&lt;br /&gt;num = A + (B-A)*Math.random() // num is random, from A to B&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: How do I extract a substring from a string?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;Answer: To extract a substring from a string, use the substring method:&lt;br /&gt;&lt;br /&gt;string.substring(start,end)&lt;br /&gt;&lt;br /&gt;Here&lt;br /&gt;string - is the string from which you want to extract a substring.&lt;br /&gt;start - is the number specifying the position of the character at which the substring begins. (The character at start itself will be included in the substring.)&lt;br /&gt;end - is the number specifying the position of the character at which the substring ends. (The character at end will not be included in the substring.)&lt;br /&gt;&lt;br /&gt;Note that the first character in the string corresponds to position 0, and the last character to position string.length-1.&lt;br /&gt;&lt;br /&gt;Examples:&lt;br /&gt;&lt;br /&gt;'Hello'.substring(0,2) // 'He'&lt;br /&gt;'Hello'.substring(0,4) // 'Hell'&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: Can I play a sound file without using JavaScript?&lt;/span&gt;&lt;/strong&gt;&lt;b&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;A: Yes, you can play a sound by specifying the sound file's URL as a hyperlink destination, for example, &lt;a href="mySound.mid"&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: How do I set a background sound on a Web page? &lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;A: In all audio-enabled browsers, you can use the EMBED tag to play a background sound. For example, if you want to play the file bkground.mid right after the browser loads the page, you can use the following EMBED tag:&lt;br /&gt;&lt;br /&gt;&lt;embed name="bkgroundID" src="bkground.mid" loop="TRUE" autostart="TRUE" hidden="TRUE"&gt;&lt;/embed&gt;&lt;br /&gt;&lt;br /&gt;To stop the background sound,call the cross-browser method document.bkgroundID.stop() .&lt;br /&gt;&lt;br /&gt;If your target browser is Microsoft Internet Explorer (for example, in an intranet), then you can use the Explorer-specific BGSOUND tag:&lt;br /&gt;&lt;br /&gt;&lt;bgsound id="bkgroundID" loop="0" volume="-600" src="bkground.mid"&gt;&lt;br /&gt;&lt;br /&gt;Here, again, bkground.mid stands for the name of the sound file that you actually want to play.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: How do I generate a user prompt from JavaScript?&lt;/span&gt;&lt;/strong&gt;&lt;b&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;A: To generate a user prompt, use the prompt() method:&lt;br /&gt;&lt;br /&gt;prompt('Prompt text','Suggested input')&lt;br /&gt;&lt;br /&gt;use the following code:&lt;br /&gt;&lt;br /&gt;&lt;form name="myform"&gt;&lt;br /&gt;&lt;input type="button" value="Try it now" onclick="f=prompt('Enter your name','Name');alert('Hello '+f+'!')"&gt; &lt;/form&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: What value does prompt() return if the user clicked the Cancel button?&lt;/span&gt;&lt;/strong&gt;&lt;b&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;A: The return value of canceled prompt() depends on the browser. In some browsers the return value is null, in others it's '' (empty string). Therefore, you might want to use the following code when calling the prompt() method:&lt;br /&gt;&lt;br /&gt;userInput = prompt('Prompt text','Suggested input');&lt;br /&gt;if (userInput != '' &amp;amp;&amp;amp; userInput != null) {&lt;br /&gt;// do something with the input&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: How do I disable a radio button in a form (making it not selectable)?&lt;/span&gt;&lt;/strong&gt;&lt;b&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;A: To make a radio button not selectable, in the button's INPUT tag you can use an onClick event handler like this:&lt;br /&gt;&lt;br /&gt;&lt;input type="radio" name="myButton" value="theValue" onclick="this.checked=false; alert('Sorry, this option is not available!')"&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: How do I change an image when the user's mouse points at it?&lt;/span&gt;&lt;/strong&gt;&lt;b&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;A: Here is a simple example:&lt;br /&gt;Point at this folder, and it will open. Move the mouse away, and the folder will close.&lt;br /&gt;&lt;br /&gt;In this example, the image is 2.gif; the image is 1.gif. Both files are stored in the ../hi-icons directory. In order to create the "mouseover" effect, the &lt;img&gt; tag is embedded in a hyperlink that has onMouseOver and onMouseOut event handlers:&lt;br /&gt;&lt;br /&gt;&lt;a href="#any_URL" onmouseover="handleOver(); return true;" onmouseout="handleOut(); return true;"&gt;&lt;br /&gt;&lt;img name="imgName" width="17" height="15" border="0" alt="This image changes when you point at it!" src="../hi-icons/2.gif" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In the &lt;head&gt; section of the page, we have JavaScript code that preloads the image files and defines the event handler functions:&lt;br /&gt;&lt;script language="JavaScript"&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;// PRELOADING IMAGES&lt;br /&gt;if (document.images) {&lt;br /&gt;img_on =new Image(); img_on.src ="../hi-icons/1.gif";&lt;br /&gt;img_off=new Image(); img_off.src="../hi-icons/2.gif";&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function handleOver() {&lt;br /&gt;if (document.images) document.imgName.src=img_on.src;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;function handleOut() {&lt;br /&gt;if (document.images) document.imgName.src=img_off.src;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;//--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: How do I check whether the user clicked the left or right mouse button?&lt;/span&gt;&lt;/strong&gt;&lt;b&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;A: The click event occurs for the left mouse button only. Therefore, onClick event handlers do not need to preform the left-versus-right button test.&lt;br /&gt;&lt;br /&gt;On the other hand, the mousedown and mouseup events may occur for any mouse button. To determine whether the user clicked the left or right button, you can use the following event properties:&lt;br /&gt;&lt;br /&gt;event.which in Netscape Navigator&lt;br /&gt;event.button in Internet Explorer&lt;br /&gt;&lt;br /&gt;If the value of these properties is 1, the event occurred for the left button. In the following example, the onMouseDown event handler displays the messages Left button or Right button, depending on the mouse button you actually have clicked. The messages will appear on your browser's status bar. Click or right-click anywhere on this page to see it work:&lt;br /&gt;&lt;br /&gt;&lt;script language="JavaScript"&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;function mouseDown(e) {&lt;br /&gt;if (parseInt(navigator.appVersion)&lt;3) {&lt;br /&gt;var clickType=1;&lt;br /&gt;if (navigator.appName=="Netscape") clickType=e.which;&lt;br /&gt;else clickType=event.button;&lt;br /&gt;if (clickType==1) self.status='Left button!';&lt;br /&gt;if (clickType!=1) self.status='Right button!';&lt;br /&gt;}&lt;br /&gt;return true;&lt;br /&gt;}&lt;br /&gt;if (parseInt(navigator.appVersion)&lt;3) {&lt;br /&gt;document.onmousedown = mouseDown;&lt;br /&gt;if (navigator.appName=="Netscape")&lt;br /&gt;document.captureEvents(Event.MOUSEDOWN);&lt;br /&gt;}&lt;br /&gt;//--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: Can I disable the Windows context menu that normally shows up when the user clicks the right mouse button?&lt;/span&gt;&lt;/strong&gt;&lt;b&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;A: In most modern browsers, you can disable the context menu by using the oncontextmenu event handler in the body tag of your page:&lt;br /&gt;&lt;br /&gt;&lt;body oncontextmenu="return false;"&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: Can I disable the right-click context menu for a particular image, while still enabling the menu for all other parts of my page?&lt;/span&gt;&lt;/strong&gt;&lt;b&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;Answer: Yes. In most modern browsers you can disable the right-click menu for a particular image. To do so, you can use the event handler oncontextmenu="return false;" within the IMG tag that defines your image:&lt;br /&gt;&lt;br /&gt;&lt;img border="0" src="..." oncontextmenu="return false;" /&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: How do I determine the week day for a given date?&lt;/span&gt;&lt;/strong&gt;&lt;b&gt;&lt;span style="color: rgb(255, 102, 0);"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/b&gt;A: To determine the week day for a given date, you set this date in a Date() object, and then get the week day using the Date.getDay() method:&lt;br /&gt;&lt;br /&gt;d=new Date();&lt;br /&gt;d.setDate(1);&lt;br /&gt;&lt;br /&gt;d.setYear(yyyy);&lt;br /&gt;d.setMonth(mm);&lt;br /&gt;d.setDate(dd);&lt;br /&gt;&lt;br /&gt;ww=d.getDay();&lt;br /&gt;if (ww==0) wDay="Sunday";&lt;br /&gt;if (ww==1) wDay="Monday";&lt;br /&gt;if (ww==2) wDay="Tuesday";&lt;br /&gt;if (ww==3) wDay="Wednesday";&lt;br /&gt;if (ww==4) wDay="Thursday";&lt;br /&gt;if (ww==5) wDay="Friday";&lt;br /&gt;if (ww==6) wDay="Saturday";&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: How can I show a different image each day?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;A:&lt;br /&gt;we can display a different image for each day of the week:&lt;br /&gt;&lt;br /&gt;&lt;script language="JavaScript"&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;var today = new Date();&lt;br /&gt;var number = today.getDay() + 1;&lt;br /&gt;document.write('&lt;img src="images/' + number + '.jpg" /&gt;');&lt;br /&gt;//--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;This creates a date object and then gets the number of the day of the week, and then uses that to display the relevant image.&lt;br /&gt;&lt;br /&gt;If you have more than 7 images then you'll need to alter this, either using the day of the month or the day of the year, or maybe even the day of the millennium!&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: How do I display a random banner image?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;A:There is an existing JavaScript method that returns a random number:&lt;br /&gt;&lt;br /&gt;//Returns a random number between 0 and 1&lt;br /&gt;function getRandom() {&lt;br /&gt;return Math.random()&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;In Netscape Navigator 2 this only works on Unix platforms, so you might want to try the following instead:&lt;br /&gt;&lt;br /&gt;&lt;script&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;rnd.today=new Date();&lt;br /&gt;rnd.seed=rnd.today.getTime();&lt;br /&gt;&lt;br /&gt;function rnd() {&lt;br /&gt;rnd.seed = (rnd.seed*9301+49297) % 233280;&lt;br /&gt;return rnd.seed/(233280.0);&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;function rand(number) {&lt;br /&gt;return Math.ceil(rnd()*number);&lt;br /&gt;};&lt;br /&gt;&lt;br /&gt;// end central randomizer. --&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;To create a random number between 1 and 10 use rand(10). To display an random image named banner1.gif to banner10.gif use:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: How do I disable the "Back" button of a browser?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;Answer:&lt;br /&gt;&lt;br /&gt;Easy answer - you can't.&lt;br /&gt;&lt;br /&gt;Longer answer - you cannot totally remove the ability for the user to go back to the previous location, although you can make it harder.&lt;br /&gt;&lt;br /&gt;1) You can use the location replace method when changing the location. This replaces the current history location with the new location. However older browsers do not support this method, which is why it is required to test for the images object:&lt;br /&gt;&lt;br /&gt;&lt;script language="JavaScript"&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;if (document.images)&lt;br /&gt;location.replace('http://www.somewhere.com/apage.html');&lt;br /&gt;else&lt;br /&gt;location.href = 'apage.html';&lt;br /&gt;//--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;Note: in Opera replace() will work, but only with absolute URL's.&lt;br /&gt;&lt;br /&gt;2) You can load the new location into another window, and then close the old window:&lt;br /&gt;&lt;br /&gt;In the first page:&lt;br /&gt;&lt;br /&gt;&lt;script langauge="JavaScript"&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;function newWindow(fileName,windowName) {&lt;br /&gt;msgWindow=window.open(fileName,windowName);&lt;br /&gt;}&lt;br /&gt;//--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="javascript:newWindow('1.html','window1')"&gt;Open Window&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;In the next window:&lt;br /&gt;&lt;br /&gt;&lt;script language="JavaScript"&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;function newWindow(fileName,windowName)&lt;br /&gt;{ msgWindow=window.open(fileName,windowName); }&lt;br /&gt;&lt;br /&gt;function replaceURL(fileName) { newWindow(fileName,'window2'); self.close();&lt;br /&gt;}&lt;br /&gt;//--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="javascript:replaceURL('2.html')"&gt;change location&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;3) You can open a window without a toolbar:&lt;br /&gt;&lt;br /&gt;&lt;script language="JavaScript"&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;msgWindow=window.open('apage.html','windowName','toolbar=no');&lt;br /&gt;//--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;However, this does not totally stop the user from being able to go back to the previous page.&lt;br /&gt;&lt;br /&gt;4) You can add code to the previous page to force the browser to go forwards again:&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: What's the difference between Java and JavaScript and why should I prevent my browser from executing JavaScript?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;A:&lt;br /&gt;JavaScript is an OO type interpreted language that runs on the clients browser, enabling interaction between the user and the document, without the need to always go back to the server for processing. for example to validate form input. There is no reason why you would want to stop JavaScript from executing on your browser, unless yet another security hole is found in the browser that allows data to be captured by a third party. All the *known* security holes have been plugged.&lt;br /&gt;&lt;br /&gt;Java is a byte compiled language that is a fully fledged OO language. It again runs on the clients browser. It can do things that JavaScript cannot do, like reading a file on the same server that the document was served from (I believe this is correct). It can do graphcs. I'm not too sure if there are valid reasons why you would not want to allow Java to execute on your browser, other than that Java applets can be quite big and can take a while to download. The initial loading of Java in the browser can take quite a few seconds to start up.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: Is there a way to close a window without that confirm message?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;Answer:&lt;br /&gt;The only way to avoid the message appearing is when you close a window that only has one location in its history. Most visitors to a site will have many locations in their current history.&lt;br /&gt;&lt;br /&gt;If you are creating a window that you then want to close later on without the message occurring, then make sure that you use the JavaScript replace() method when changing the location within that window, that way you will not create new entries within that windows history object.&lt;br /&gt;&lt;br /&gt;To use the replace method without causing errors on browsers that don't support it you'll need to do the following:&lt;br /&gt;&lt;br /&gt;&lt;script language="JavaScript"&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;function go(url) {&lt;br /&gt;if (document.images)&lt;br /&gt;location.replace(url);&lt;br /&gt;else&lt;br /&gt;location.href = url;&lt;br /&gt;}&lt;br /&gt;//--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;And then for all your links in that window:&lt;br /&gt;&lt;br /&gt;&lt;a href="javascript:go('http://somewhere.com/nextpage.html')"&gt;Next Page&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Make sure you use the absolute URL, because in some versions of Opera, an absolute reference will cause problems when used with the replace() method.&lt;br /&gt;&lt;br /&gt;Note that for browsers that don't support the replace method (the same as those that don't support the image object) the window will build up entries in the history object.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: How can I disable the "View Source" menu item?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;A:&lt;br /&gt;Sorry, not possible.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: How can I calculate the number of days elapsed between two dates?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;A:&lt;br /&gt;&lt;br /&gt;&lt;script language="JavaScript"&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;function y2k(number) {&lt;br /&gt;return (number &lt; 1000) ? number + 1900 :&lt;br /&gt;number; }&lt;br /&gt;&lt;br /&gt;function daysElapsed(date1,date2) {&lt;br /&gt;var difference = Date.UTC(y2k(date1.getYear()), date1.getMonth(),date1.getDate(),0,0,0) - Date.UTC(y2k(date2.getYear()), date2.getMonth(),date2.getDate(),0,0,0);&lt;br /&gt;&lt;br /&gt;return difference/1000/60/60/24;}&lt;br /&gt;&lt;br /&gt;document.write(daysElapsed(new Date(2000,0,1), new Date(1999,11,31)));&lt;br /&gt;//--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: How do you subtract X hours from a date?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;A:&lt;br /&gt;&lt;br /&gt;The following subtracts five hours from the current date and time:&lt;br /&gt;&lt;br /&gt;&lt;script language =" 'JavaScript'"&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;function y2k(number) {&lt;br /&gt;return (number &lt; 1000) ? number + 1900 : number;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;var date = new Date();&lt;br /&gt;var date = new Date(Date.UTC(y2k(date.getYear()), date.getMonth(),date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds()) - 5*60*60*1000);&lt;br /&gt;document.write(date);&lt;br /&gt;//--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: How can I calculate the difference between two dates?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;Answer:&lt;br /&gt;&lt;script language="JavaScript"&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;function timeDifference(laterdate,earlierdate) {&lt;br /&gt;var difference = laterdate.getTime() - earlierdate.getTime();&lt;br /&gt;var daysDifference = Math.floor(difference/1000/60/60/24);&lt;br /&gt;difference -= daysDifference*1000*60*60*24&lt;br /&gt;var hoursDifference = Math.floor(difference/1000/60/60);&lt;br /&gt;difference -= hoursDifference*1000*60*60&lt;br /&gt;var minutesDifference = Math.floor(difference/1000/60);&lt;br /&gt;difference -= minutesDifference*1000*60&lt;br /&gt;var secondsDifference = Math.floor(difference/1000);&lt;br /&gt;&lt;br /&gt;document.write('difference = ' + daysDifference + ' day/s ' + hoursDifference + ' hour/s ' + minutesDifference + ' minute/s ' + secondsDifference + ' second/s ');}&lt;br /&gt;&lt;br /&gt;var laterdate = new Date(2000,0,1); // 1st January 2000&lt;br /&gt;var earlierdate = new Date(1998,2,13); // 13th March 1998&lt;br /&gt;timeDifference(laterdate,earlierdate);&lt;br /&gt;//--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: How can I calculate the number of days in the current month?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;A:&lt;br /&gt;The following little gem was provided by Paul Bennett. At first look it looks too simple, but on closer investigation it is a pretty clever piece of code:&lt;br /&gt;&lt;br /&gt;function days_in_month (year, month) {&lt;br /&gt;return 32 - new Date(year, month, 32).getDate();&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: How can I convert a text string: "Wed Aug 26 14:40:45 MET DST 1998." into a Date object?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;Answer:&lt;br /&gt;The date foramt has to be altered to:&lt;br /&gt;&lt;br /&gt;Wed, 26 Aug 1998 14:40:45So:&lt;br /&gt;&lt;br /&gt;&lt;script language="JavaScript"&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;var textdate = 'Wed Aug 26 14:40:45 MET DST 1998.';&lt;br /&gt;var myArray = textdate.split(' ');&lt;br /&gt;var input = myArray[0] + ', ' + myArray[2] + ' ' + myArray[1] + ' ' + myArray[3] + ' ' + myArray[6].substring(0,4);&lt;br /&gt;var output = Date.parse(input);&lt;br /&gt;var mydate = new Date(output)&lt;br /&gt;//--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: How can I convert a mm/dd/yy date to dd/mm/yy and vice versa?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;Answer:&lt;br /&gt;&lt;br /&gt;&lt;script language="JavaScript"&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;var mmddyy = "12/31/99";&lt;br /&gt;alert(mmddyy)&lt;br /&gt;var mm = mmddyy.substring(0,2);&lt;br /&gt;var dd = mmddyy.substring(3,5);&lt;br /&gt;var yy = mmddyy.substring(6,8);&lt;br /&gt;var ddmmyy = dd + '/' + mm + '/' + yy;&lt;br /&gt;alert(ddmmyy);&lt;br /&gt;&lt;br /&gt;// and back again...&lt;br /&gt;&lt;br /&gt;var dd = ddmmyy.substring(0,2);&lt;br /&gt;var mm = ddmmyy.substring(3,5);&lt;br /&gt;var yy = ddmmyy.substring(6,8);&lt;br /&gt;mmddyy = mm + '/' + dd + '/' + yy;&lt;br /&gt;alert(mmddyy);&lt;br /&gt;//--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: How do I add a number of days to a date?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;Answer:&lt;br /&gt;&lt;script language="JavaScript"&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;function addDays(myDate,days) {&lt;br /&gt;return new Date(myDate.getTime() + days*24*60*60*1000);&lt;br /&gt;}&lt;br /&gt;alert(addDays(new Date(),10));&lt;br /&gt;//--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: How can I cancel the users F5 request to refresh the page in Internet Explorer?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;Answer:&lt;br /&gt;&lt;br /&gt;Do it by redirecting the keyboard action on another keycode that you can control (backspace in this example):&lt;br /&gt;&lt;br /&gt;function cancelRefresh() {&lt;br /&gt;// keycode for F5 function&lt;br /&gt;if (window.event &amp;amp;&amp;amp; window.event.keyCode == 116) {&lt;br /&gt;window.event.keyCode = 8;&lt;br /&gt;}&lt;br /&gt;// keycode for backspace&lt;br /&gt;if (window.event &amp;amp;&amp;amp; window.event.keyCode == 8) {&lt;br /&gt;// try to cancel the backspace&lt;br /&gt;window.event.cancelBubble = true;&lt;br /&gt;window.event.returnValue = false;&lt;br /&gt;return false; }}&lt;br /&gt;&lt;br /&gt;This function is called on the onKeyDown event and it seems to work!&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: When creating a form, how can I check to see if data entered in a text field contains all numerics?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;A:&lt;br /&gt;&lt;br /&gt;&lt;script language="JavaScript"&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;function validate(string) {&lt;br /&gt;if (!string) return false;&lt;br /&gt;var Chars = "0123456789";&lt;br /&gt;for (var i = 0; i &lt; string.length; i++) {&lt;br /&gt;if (Chars.indexOf(string.charAt(i)) == -1)&lt;br /&gt;return false;&lt;br /&gt;}&lt;br /&gt;return true;&lt;br /&gt;}&lt;br /&gt;//--&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;form&gt;&lt;br /&gt;&lt;input type="text" onchange="if (!validate(this.value)) alert('Not Valid')"&gt;&lt;br /&gt;&lt;/form&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: How do I get a word count of the text in a textarea?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;Answer:&lt;br /&gt;&lt;br /&gt;&lt;script language="JavaScript"&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;function wordcount(string) {&lt;br /&gt;var a = string.split(/\s+/g); // split the sentence into an array of words return a.length;&lt;br /&gt;}&lt;br /&gt;//--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;form name="myForm"&gt;&lt;br /&gt;&lt;textarea name="myText" rows="3" cols="40"&gt;&lt;br /&gt;&lt;br /&gt;This is some sample text. There is punctuation (sprinkled)about, plus some line-separators. The answer should be 19.&lt;br /&gt;&lt;form&gt;&lt;br /&gt;&lt;input type="button" value="Word Count" onclick="alert(wordcount(this.form.myText.value))"&gt;&lt;br /&gt;&lt;/form&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: How can I stop a user from hitting the Submit button twice?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;Answer:&lt;br /&gt;&lt;br /&gt;&lt;form onsubmit="if (this.submitted) return false; this.submitted = true; return true"&gt;&lt;br /&gt;&lt;input type="submit"&gt;&lt;br /&gt;&lt;/form&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: there a way to restrict number of characters within a textarea?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;Answer:&lt;br /&gt;&lt;br /&gt;&lt;form&gt; &lt;textarea onkeyup=""&gt; 100) { alert('100 chars max'); this.value = this.value.substring(0,99); }"&gt;&lt;/textarea&gt; &lt;/form&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: When a page reloads (due to the user pressing back) how do I clear a form of all the user entered data?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;Answer:&lt;br /&gt;&lt;br /&gt;Simply invoke the form's reset method, immediately after defining the form, for example:&lt;br /&gt;&lt;br /&gt;&lt;form name="myForm"&gt;&lt;br /&gt;&lt;input type="text"&gt;&lt;br /&gt;&lt;/form&gt;&lt;br /&gt;&lt;br /&gt;&lt;script language="JavaScript"&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;document.myForm.reset();&lt;br /&gt;//--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: How can I extract just the extension file name from a forms file upload field?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;Answer:&lt;br /&gt;&lt;br /&gt;&lt;html&gt;&lt;br /&gt;&lt;head&gt;&lt;br /&gt;&lt;script language="JavaScript"&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;function getExtension(value) {&lt;br /&gt;return value.substring(value.lastIndexOf('.') + 1,value.length);&lt;br /&gt;}&lt;br /&gt;//--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;/head&gt;&lt;br /&gt;&lt;body&gt;&lt;br /&gt;&lt;form&gt;&lt;br /&gt;&lt;input name="myFile" type="file"&gt;&lt;br /&gt;&lt;input type="button" value="Extract" onclick="alert(getExtension(this.form.myFile.value))"&gt;&lt;br /&gt;&lt;/form&gt;&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;/html&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: How can I check where a visitor has come from?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;A:&lt;br /&gt;&lt;br /&gt;&lt;script language="JavaScript"&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;if (document.referrer != '')&lt;br /&gt;document.write('You came from: ' + document.referrer);&lt;br /&gt;//--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: How can you make a .wav play when you click on an image?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;A:&lt;br /&gt;&lt;br /&gt;You should use the &lt;embed&gt; tag.&lt;br /&gt;&lt;br /&gt;The following will play the midi or wav file as soon as its loaded on a Java enabled browser:&lt;br /&gt;&lt;br /&gt;The following allows you control when it plays:&lt;br /&gt;&lt;br /&gt;&lt;html&gt;&lt;br /&gt;&lt;body&gt;&lt;br /&gt;&lt;script language="JavaScript"&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;function playSound() {&lt;br /&gt;document.firstSound.play();&lt;br /&gt;}&lt;br /&gt;function pauseSound() {&lt;br /&gt;document.firstSound.pause();&lt;br /&gt;}&lt;br /&gt;function stopSound() {&lt;br /&gt;document.firstSound.stop();&lt;br /&gt;}&lt;br /&gt;//--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;a href="javascript:playSound()"&gt;&lt;br /&gt;&lt;img src="play.gif" width="100" hight="100" /&gt;&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="javascript:pauseSound()"&gt;&lt;br /&gt;&lt;img src="pause.gif" width="100" hight="100" /&gt;&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="javascript:stopSound()"&gt;&lt;br /&gt;&lt;img src="stop.gif" width="100" hight="100" /&gt;&lt;br /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;embed src="sound.wav" hidden="true" autostart="false" loop="false" name="firstSound"&gt;&lt;/embed&gt;&lt;/body&gt;&lt;br /&gt;&lt;/html&gt;&lt;br /&gt;&lt;br /&gt;You can replace sound.wav with sound.mid.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: When I open a new window, how can I change the contents of the original window from the new window?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;A:&lt;br /&gt;&lt;br /&gt;Within the original window:&lt;br /&gt;&lt;br /&gt;&lt;script language="JavaScript"&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;function newWindow(file,window) {&lt;br /&gt;msgWindow=open(file,window,'resizable=no,width=200,height=200');&lt;br /&gt;if (msgWindow.opener == null) msgWindow.opener = self;&lt;br /&gt;}&lt;br /&gt;//--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;form&gt;&lt;br /&gt;&lt;input type="button" value="Open New Window" onclick="newWindow('a.html','window2')"&gt;&lt;br /&gt;&lt;/form&gt;&lt;br /&gt;&lt;br /&gt;Within the new window:&lt;br /&gt;&lt;br /&gt;&lt;script language="JavaScript"&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;function load(file,target) {&lt;br /&gt;if (target != '')&lt;br /&gt;target.window.location.href = file;&lt;br /&gt;else&lt;br /&gt;window.location.href = file;&lt;br /&gt;}&lt;br /&gt;//--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="javascript:load('b.html',top.opener)"&gt;load document into opener&lt;/a&gt;&lt;br /&gt;&lt;p&gt;&lt;br /&gt;&lt;a href="javascript:load('b.html','')"&gt;load document&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: How do I open a window at a given position on the screen?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;A:&lt;br /&gt;In Netscape Navigator 4 the screenX and screenY attributes were introduced. In Internet Explorer 4 the top and left attributes were introduced. By combining the two both Netscape Navigator 4 and Internet Explorer 4 will allow you to position the window:&lt;br /&gt;&lt;br /&gt;&lt;script language="JavaScript"&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;function openWindow() {&lt;br /&gt;msgWindow = window.open('','newWin','width=100, height=100, screenX=400, screenY=400, top=400, left=400'); msgWindow.location.href = 'apage.html';}&lt;br /&gt;//--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;&lt;form&gt;&lt;br /&gt;&lt;input type="button" onclick="openWindow()" value="Click Me"&gt;&lt;br /&gt;&lt;/form&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: Is it possible to close the parent window (main web browser window) from a child window?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;A:&lt;br /&gt;&lt;br /&gt;Put the following in the child:&lt;br /&gt;&lt;br /&gt;&lt;script langauge="JavaScript"&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;opener.close();&lt;br /&gt;//--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;Although you'll need to make sure that the opener has been defined for browsers that don't have it by default, by placing the following in the parent:&lt;br /&gt;&lt;br /&gt;&lt;script language="JavaScript"&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;msgWindow=open('',window,'resizable=no,width=200,height=200');&lt;br /&gt;msgWindow.location.href ='apage.html';&lt;br /&gt;if (msgWindow.opener == null) msgWindow.opener = self;&lt;br /&gt;//--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;br /&gt;Note, that this will likely prompt the user for confirmation before closing the window.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: How can I close a popup window after, say, 5 seconds?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;A:&lt;br /&gt;&lt;br /&gt;&lt;html&gt;&lt;br /&gt;&lt;head&gt;&lt;br /&gt;&lt;script language="JavaScript"&gt;&lt;br /&gt;&lt;!--setTimeout('self.close()',5000);&lt;br /&gt;//--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt;&lt;head&gt;&lt;br /&gt;&lt;body&gt;...&lt;br /&gt;&lt;/body&gt;&lt;br /&gt;&lt;/html&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: How do you return the results from a query into a new window?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;A:&lt;br /&gt;&lt;br /&gt;&lt;form action="apage.html" target="newwindow"&gt;&lt;br /&gt;&lt;input type="SUBMIT"&gt;&lt;br /&gt;&lt;/form&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: Is it possible to disallow a pop-up window to be maximized?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;A:&lt;br /&gt;&lt;br /&gt;When opening a window use the attribute resizable:&lt;br /&gt;&lt;br /&gt;window.open('apage.html','myWIndow','resizable=no');&lt;br /&gt;&lt;br /&gt;The code does not work in Internet Explorer - you can maximise the window, and the resizable=no is ignored once you restore the size.&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: Can i get Javascript counter?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;A:&lt;br /&gt;&lt;br /&gt;JavaScript CAN NOT do a Web page counter alone. You will have to use a CGI script, or Java as well. The reason for this is that JavaScript can not write to external files, something necessary to run a counter (updating hit count).&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&lt;span style="font-family: &amp;quot;Verdana&amp;quot;,&amp;quot;sans-serif&amp;quot;; color: rgb(255, 102, 0);"&gt;Q: How do i clear the user's cache?&lt;/span&gt;&lt;/strong&gt;&lt;br /&gt;A:&lt;br /&gt;There are several things that can't be done with JavaScript for security reasons, including such things as changing user preferences or clearing the cache.&lt;br /&gt;&lt;br /&gt;However, I do have a slick workaround that prevents a page from being stored in the user's cache. (You don't have to clear the cache if the page isn't in the cache!) Anyways, on with it. The code to stick in the HEAD section of your page is this:&lt;br /&gt;&lt;br /&gt;&lt;meta equiv="pragma" content="no-cache"&gt;&lt;br /&gt;&lt;meta equiv="Expires" content="Thu, 01 Dec 1994 120000 GMT"&gt;&lt;br /&gt;&lt;br /&gt;Note: The second 'Expires' tag is not necessary for all browsers, but some browsers do use with the 'no-cache' tag, so it is best to just leave it in for good measure.&lt;/span&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7722578078463485731-8612792966177490508?l=javascriptfaqs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascriptfaqs.blogspot.com/feeds/8612792966177490508/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7722578078463485731&amp;postID=8612792966177490508' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7722578078463485731/posts/default/8612792966177490508'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7722578078463485731/posts/default/8612792966177490508'/><link rel='alternate' type='text/html' href='http://javascriptfaqs.blogspot.com/2008/10/javascript-faqs.html' title='Javascript Faqs'/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</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><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7722578078463485731.post-2773098652752531690</id><published>2008-08-06T07:19:00.000-07:00</published><updated>2008-12-23T21:48:13.485-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Script'/><title type='text'>Event Handlers </title><content type='html'>&lt;br /&gt;JavaScript programs are typically event-driven. Events are actions that occur on the Web page, usually as a result of something the user does, although not always. For example, a button click is an event, as is giving focus to a form element; resizing the page is an event, as is submitting a form. It is these events which cause JavaScript programs to spring into action. For example, if you move your mouse over this phrase, a message will pop-up, courtesy of JavaScript.&lt;br /&gt;&lt;br /&gt;An event, then, is the action which triggers an event handler. The event handler specifies which JavaScript code to execute. Often, event handlers are placed within the HTML tag which creates the object on which the event acts:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;tag attribute1 attribute2 onEventName="javascript code;"&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;For example, a hyperlink is subject to a MouseOver event, meaning that its event handler will be triggered when the mouse passes over the link. Therefore, you place the event handler for a hyperlink's MouseOver inside the A tag:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;a href="" onMouseOver="popupFunc();"&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;The JavaScript which is called by the event handler may be any valid JavaScript code: a single statement or a series of statements, although most often it is a function call.&lt;br /&gt;&lt;br /&gt;The set of all events which may occur, and the particular page elements on which they can occur, is part of the Document Object Model (DOM), and not JavaScript itself (see the earlier section "Document Object Model"). As a result, Netscape and Microsoft do not share the exact same set of events, nor are all page elements subject to the same events between browsers. For example, Internet Explorer 4 supports a MouseOver event for an image while Navigator 4 does not.&lt;br /&gt;&lt;br /&gt;The table below illustrates some of the most commonly used events supported in both DOM's. Because the DOM's differ in their event support, the following documents are recommended as an overview of each browser's event support: &lt;br /&gt;&lt;br /&gt;Navigator 4: Event Handlers Summary &lt;br /&gt;MSIE 4: DHTML Event Summary &lt;br /&gt; &lt;br /&gt;&lt;br /&gt;Common Events  Event &lt;br /&gt; &lt;br /&gt;Occurs when... &lt;br /&gt; &lt;br /&gt;Event Handler &lt;br /&gt; &lt;br /&gt;click User clicks on form element or link  onClick &lt;br /&gt;change User changes value of text, textarea, or select element onChange &lt;br /&gt;focus User gives form element input focus onFocus &lt;br /&gt;blur User removes input focus from form element onBlur &lt;br /&gt;mouseover User moves mouse pointer over a link or anchor onMouseOver &lt;br /&gt;mouseout User moves mouse pointer off of link or anchor onMouseOut &lt;br /&gt;select User selects form element's input field onSelect &lt;br /&gt;submit User submits a form onSubmit &lt;br /&gt;resize User resizes the browser window onResize &lt;br /&gt;load User loads the page in the Navigator onLoad &lt;br /&gt;unload User exits the page onUnload &lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7722578078463485731-2773098652752531690?l=javascriptfaqs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascriptfaqs.blogspot.com/feeds/2773098652752531690/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7722578078463485731&amp;postID=2773098652752531690' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7722578078463485731/posts/default/2773098652752531690'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7722578078463485731/posts/default/2773098652752531690'/><link rel='alternate' type='text/html' href='http://javascriptfaqs.blogspot.com/2008/08/event-handlers.html' title='Event Handlers '/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</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><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7722578078463485731.post-1835331889668583068</id><published>2008-08-06T07:18:00.002-07:00</published><updated>2008-12-23T21:48:13.485-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Script'/><title type='text'>Objects</title><content type='html'>An object is a "package" of data; a collection of properties (variables) and methods (functions) all classed under a single name. For example, imagine that there was an object named car. We could say that the car object possesses several properties: make, model, year, and color, for example. We might even say that car possesses some methods: go(), stop(), and reverse(). Although car is obviously fictional, you can see that its properties and methods all relate to a common theme.&lt;br /&gt;&lt;br /&gt;In JavaScript you may create your own objects for storing data. More commonly, though, you will use the many "built-in" objects which allow you to work with, manipulate, and access the Web page and Web browser. This set of pre-existing objects is known as the "Document Object Model".&lt;br /&gt;&lt;br /&gt;Document Object Model&lt;br /&gt;Often referred to as the DOM,  this object model is a hierarchy of all objects "built in" to JavaScript. Most of these objects are directly related to characteristics of the Web page or browser. The reason we qualify the term "built in" is because the DOM is technically separate from JavaScript itself. That is, the JavaScript language specification, standardized by the ECMA, does not actually specify the nature or specifics of the DOM. Consequently, Netscape and Microsoft have developed their own individual DOM's which are not entirely compatible. Additionally, the DOM stands apart from JavaScript because it could theoretically be accessed by other scripting languages as well.&lt;br /&gt;&lt;br /&gt;In summary, then, what we refer to as "JavaScript" is actually made up of both JavaScript, the language, and the DOM, or object model which JavaScript can access. In a future WDVL article we will take a closer look at the DOM and its current and future role.&lt;br /&gt;&lt;br /&gt;Below is a graphical chart illustrating a high-level view of Netscape's DOM. Microsoft's DOM is actually a superset of Netscape's, and so the chart below actually represents a subset of Microsoft's own DOM.&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;Reprinted from Netscape's JavaScript Guide &lt;br /&gt; &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Properties&lt;br /&gt;Access the properties of an object with a simple notation: objectName.propertyName. Both the object name and property name are case sensitive, so watch your typing. Because a property is essentially a variable, you can create new properties by simply assigning it a value. Assuming, for instance, that carObj already exists (we'll learn to create a new object shortly), you can give it properties named make, model, and year as follows:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;carObj.make="Toyota";&lt;br /&gt;carObj.model="Camry";&lt;br /&gt;carObj.year=1990;&lt;br /&gt;document.write(carObj.year);&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;A JavaScript object, basically, is an array. If you're familiar with other languages you probably recognize an array as a collection of values residing within a single named data structure. You can access an object's properties either using the objectName.propertyName syntax illustrated above, or by using an array syntax:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;carObj["make"]="Toyota";&lt;br /&gt;carObj["model"]="Camry";&lt;br /&gt;document.write(carObj["year"]);&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;Methods&lt;br /&gt;Unlike a basic data array, an object can also contain functions, which are known as methods when part of an object. You call a method using the basic syntax: objectName.methodName(). Any arguments required for the method are passed between the parentheses, just like a normal function call.&lt;br /&gt;&lt;br /&gt;For example, the window object possesses a method named close(), which simply closes the specified browser window:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;window.close();&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;Creating Objects&lt;br /&gt;Most of the time you will be referencing objects which are built-in to the DOM. However, you may want to create your own objects for storing data within a JavaScript program. There are several ways to create a new object, but we'll look at two: creating a direct instance of an object and creating an object prototype.&lt;br /&gt;&lt;br /&gt;direct instance of an object&lt;br /&gt;Despite the awkward sound name, a "direct instance of an object" simply means creating a new single object, such as myPetDog:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;myPetDog=new Object();&lt;br /&gt; myPetDog.name="Barney"; &lt;br /&gt; myPetDog.breed="beagle";&lt;br /&gt; myPetDog.year=1981;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;Assigning a method to your new object is also simple. Assume that you already have coded a function named woof(), which causes a barking sound to play:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;myPetDog.woof=woof;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;prototype of an object&lt;br /&gt;Sometimes, you'll want to create a "template" or prototype of an object. This does not create an actual instance of the object, but defines the structure of the object. In the future, then, you can quickly stamp out a particular instance of the object. Suppose that instead of myPetDog, you created a prototype object named petDog. This object could then be a template for a particular pet dog object. First, create a function which defines the petDog structure:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;function petDog(name, breed, year) &lt;br /&gt;{ this.name = name;&lt;br /&gt;  this.breed = breed;&lt;br /&gt;  this.year = year;&lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;Now that the petDog prototype has been set, you can quickly create single instances of a new object based on the petDog structure:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;myPetDog=new petDog("barney","beagle",1981);&lt;br /&gt;yourPetDog=new petDog("max","terrier",1990);&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7722578078463485731-1835331889668583068?l=javascriptfaqs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascriptfaqs.blogspot.com/feeds/1835331889668583068/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7722578078463485731&amp;postID=1835331889668583068' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7722578078463485731/posts/default/1835331889668583068'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7722578078463485731/posts/default/1835331889668583068'/><link rel='alternate' type='text/html' href='http://javascriptfaqs.blogspot.com/2008/08/objects.html' title='Objects'/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</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><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7722578078463485731.post-540564633937626889</id><published>2008-08-06T07:18:00.001-07:00</published><updated>2008-12-23T21:48:13.485-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Script'/><title type='text'>Functions </title><content type='html'>&lt;br /&gt;A function groups together a set of statements under a named subroutine. This allows you to conveniently "call" the function whenever its action is required. Functions are a fundamental building block of most JavaScript programs, so you'll become quite familiar with their use. Before you can call on a function, of course, you must first create it. We can break down the use of functions, then, into two logical categories: defining functions and calling functions.&lt;br /&gt;&lt;br /&gt;defining functions&lt;br /&gt;The function definition is a statement which describes the function: its name, any values (known as "arguments") which it accepts incoming, and the statements of which the function is comprised.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;function funcName(argument1,argument2,etc)&lt;br /&gt;{ statements; }&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;A function doesn't necessarily require arguments, in which case you need only write out the parenthesis; e.g. funcName(). If you do specify arguments, those arguments will be variables within the function body (the statements which make up the function). The initial values of those variables will be any values passed on by the function call.&lt;br /&gt;&lt;br /&gt;Generally it's best to define the functions for a page in the HEAD portion of a document. Since the HEAD is loaded first, this guarantees that functions are loaded before the user has a chance to do anything that might call a function. Alternately, some programmers place all of their functions into a separate file, and include them in a page using the SRC attribute of the SCRIPT tag. Either way, the key is to load the function definitions before any code is executed.&lt;br /&gt;&lt;br /&gt;Consider, for example, a simple function which outputs an argument to the Web page, as a bold and blinking message:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;function boldblink(message)&lt;br /&gt;{ document.write("&lt;blink&gt;&lt;strong&gt;"+message+"&lt;/blink&gt;&lt;/strong&gt;"); }&lt;br /&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;Some functions may return a value to the calling expression. The following function accepts two arguments, x and y, and returns the result of x raised to the y power:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;function raiseP(x,y)&lt;br /&gt;{ total=1;&lt;br /&gt;  for (j=0; j&lt;y; j++)&lt;br /&gt;   { total*=x; }&lt;br /&gt;  return total; //result of x raised to y power&lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;calling functions&lt;br /&gt;A function waits in the wings until it is called onto the stage. You call a function simply by specifying its name followed by a parenthetical list of arguments, if any:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;clearPage();&lt;br /&gt;boldblink("Call me gaudy!");&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;Functions which return a result should be called from within an expression:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;total=raiseP(2,8);&lt;br /&gt;if (raiseP(tax,2)&lt;100) ...&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;Quite commonly, JavaScript functions are called from within event handlers, which we'll take a look at later in this article.&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7722578078463485731-540564633937626889?l=javascriptfaqs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascriptfaqs.blogspot.com/feeds/540564633937626889/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7722578078463485731&amp;postID=540564633937626889' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7722578078463485731/posts/default/540564633937626889'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7722578078463485731/posts/default/540564633937626889'/><link rel='alternate' type='text/html' href='http://javascriptfaqs.blogspot.com/2008/08/functions.html' title='Functions '/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</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><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7722578078463485731.post-7220645037036389643</id><published>2008-08-06T07:17:00.001-07:00</published><updated>2008-12-23T21:48:13.485-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Script'/><title type='text'>Statements</title><content type='html'>Statements define the flow of a script, known as "program flow." A statement, like a fully grammatical English sentence, is made up of smaller expressions which, altogether, evaluate into a cogent meaning. In JavaScript, statements are organized as either conditionals, loops, object manipulations, and comments.&lt;br /&gt;&lt;br /&gt;Good practice suggests that each JavaScript statements should be terminated with a semicolon (;). This is often not strictly necessary, as a new line also serves to separate statements, but when multiple statements reside on the same line the semicolon delimiter is mandatory.&lt;br /&gt;&lt;br /&gt;A set of statements that is surrounded by braces is called a block. Blocks of statements are used, for example, in functions and conditionals.&lt;br /&gt;&lt;br /&gt;Normally statements are executed sequentially: x = 1; y = 2; z = x + y; but this can be altered by some statements which test a condition and branch or loop according to the result.&lt;br /&gt;&lt;br /&gt;Conditionals&lt;br /&gt;Conditional statements direct program flow in specified directions depending upon the outcomes of specified conditions. These tests are a major influence on the order of execution in a program.&lt;br /&gt;&lt;br /&gt;if...else&lt;br /&gt;As seen in many programming languages, if the condition evaluates to true then the block of statements1 is executed. Optionally, an else clause specifies a block of statements2 which are executed otherwise. You may omit the else clause if there are no statements which need to be executed if the condition is false.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;if (condition) &lt;br /&gt; { statements1; }&lt;br /&gt;&lt;br /&gt;else    &lt;br /&gt; { statements2; }&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;switch (Netscape &amp; MSIE 4)&lt;br /&gt;Commonly known as a "case statement," switch matches an expression with a specified case, and executes the statements defined for that case. In essence, the switch statement is a sort of shorthand for combining many implied if statements together.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;switch (expression){&lt;br /&gt;   case label : &lt;br /&gt;      statement;&lt;br /&gt;      break;&lt;br /&gt;   case label : &lt;br /&gt;      statement;&lt;br /&gt;      break;&lt;br /&gt;   ...&lt;br /&gt;   default : statement;&lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;For example, imagine that you wanted to execute different sets of statements depending on whether favoritePet was "dog," "cat," or "iguana." Note that the break; statement prevents any cases below the match from being executed. The default case is matched if none of the cases match the expression. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;switch (favoritePet){&lt;br /&gt;   case "dog" : &lt;br /&gt;      statements;&lt;br /&gt;      break;&lt;br /&gt;   case "cat" : &lt;br /&gt;      statements;&lt;br /&gt;      break;&lt;br /&gt;   case "iguana" :&lt;br /&gt;      statements;&lt;br /&gt;      break;&lt;br /&gt;   default : statements;&lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;Loops&lt;br /&gt;for&lt;br /&gt;The venerable for loop repeatedly cycles through a block of statements until a test condition is false. Typically, the number of times a loop is repeated depends on a counter. The JavaScript for syntax incorporates the counter and its increments:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;for (initial-statement; test; increment) &lt;br /&gt; { statements; }&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;The initial-statement is executed first, and once only. Commonly, this statement is used to initialize a counter variable. Then the test is applied and if it succeeds then the statements are executed. The increment is applied to the counter variable and then the loop starts again. For instance, consider a loop which executes 10 times:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;for (i=0; i&lt;10; i++) &lt;br /&gt; { statements; }&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;do...while (Netscape &amp; MSIE 4)&lt;br /&gt;Another loop, a do...while statement executes a block of statements repeatedly until a condition becomes false. Due to its structure, this loop necessarily executes the statement at least once.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;do &lt;br /&gt; { statements;} &lt;br /&gt;while (condition)&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;while&lt;br /&gt;In similar fashion as the do...while statement, the while statement executes its statement block as long as the condition is true. The main difference between while and do...while, aside from the fact that only while is supported in all JavaScript versions, is that a while loop may not execute the statements even once if the condition is initially false.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;while (condition) &lt;br /&gt; { statements; }&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;break and continue&lt;br /&gt;Both of these statements may be used to "jump the tracks" of an iterating loop. When used within the statement block of a loop, each statement behaves slightly differently:&lt;br /&gt;&lt;br /&gt;break Aborts execution of the loop, drops out of loop to the next statement following the loop. &lt;br /&gt;continue Aborts this single iteration of the loop, returns execution to the loop control, meaning the condition specified by the loop statement. Loop may execute again if condition is still true. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Object manipulation&lt;br /&gt;for...in&lt;br /&gt;The sometimes confusing for...in statement is used to cycle through each property of an object or each element of an array. The idea is that you may want to execute a statement block which operates on every property or element.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;for (variable in object) &lt;br /&gt; { statements; }&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;Imagine, for example, that an object named wine1 has five properties: vineyard, year, varietal, alcohol, and color. You want to output the value of each property, as if producing a record from a database.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;var record = "Wine 1&lt;br&gt;&lt;br&gt;"&lt;br /&gt;for (var prop in wine1)&lt;br /&gt; {record += prop + " = " + wine1[prop] + "&lt;BR&gt;"}&lt;br /&gt;record += "&lt;br&gt;"&lt;br /&gt;document.write(record)&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;with&lt;br /&gt;The with statement serves as a sort of shorthand, allowing you to execute a series of statement who all assume a specified object as the reference. In other words, the object specified in the with statement is used as the default object whenever a property is encountered with no object specified.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;with (object) &lt;br /&gt; { statements; }&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;Comments&lt;br /&gt;Despite the fact that comments are purely optional, they can easily be a crucial part of your program. Comments can explain the action, like a color commentary, which can be a great help in understanding the code. Whether as a teaching tool or to simply remind yourself what the code does, comments are best sprinkled liberally throughout a program. Remember, comments are for humans, so write them that way!&lt;br /&gt;&lt;br /&gt;Comments can also be used for debugging -- you can comment "out" sections of code to prevent them from being executed. In doing so you may learn more about why a certain problem is occurring in your program.&lt;br /&gt;&lt;br /&gt;Because JavaScript must ignore comments, there is an appropriate syntax for demarcating text as a comment. For single line comments, simply precede the line with two backslashes. For multi-line comment blocks, begin the comment with /* and close with */.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;//A lonely ol' single line comment&lt;br /&gt;/* A dense thicket of commentary, spanning many captivating lines&lt;br /&gt;of explanation and intrigue. */&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7722578078463485731-7220645037036389643?l=javascriptfaqs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascriptfaqs.blogspot.com/feeds/7220645037036389643/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7722578078463485731&amp;postID=7220645037036389643' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7722578078463485731/posts/default/7220645037036389643'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7722578078463485731/posts/default/7220645037036389643'/><link rel='alternate' type='text/html' href='http://javascriptfaqs.blogspot.com/2008/08/statements.html' title='Statements'/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</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><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7722578078463485731.post-5199575508153801064</id><published>2008-08-06T07:16:00.000-07:00</published><updated>2008-12-23T21:48:13.486-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Script'/><title type='text'>Operators</title><content type='html'>Operators take one or more variables or values (operands) and return a new value; e.g. the '+' operator can add two numbers to produce a third. You use operators in expressions to relate values, whether to perform arithmetic or compare quantities. Operators are divided into several classes depending on the relation they perform:&lt;br /&gt;&lt;br /&gt;arithmetic or computational&lt;br /&gt;Arithmetic operators take numerical values (either literals or variables) as their operands and return a single numerical value. The standard arithmetic operators are:&lt;br /&gt;&lt;br /&gt;+ Addition &lt;br /&gt;- Subtraction &lt;br /&gt;* Multiplication &lt;br /&gt;/ Division &lt;br /&gt;% Modulus: the remainder after division; &lt;br /&gt;e.g. 10 % 3 yields 1.  &lt;br /&gt;++ Unary increment: this operator only takes one operand. The operand's value is increased by 1. The value returned depends on whether the ++ operator is placed before or after the operand; e.g. ++x will return the value of x following the increment whereas x++ will return the value of x prior to the increment. &lt;br /&gt;-- Unary decrement: this operator only takes one operand. The operand's value is decreased by 1. The value returned depends on whether the -- operator is placed before or after the operand; e.g. --x will return the value of x following the decrement whereas x-- will return the value of x prior to the decrement. &lt;br /&gt;- Unary negation: returns the negation of operand.  &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;comparison&lt;br /&gt;A comparison operator compares its operands and returns a logical value based on whether the comparison is true or not. The operands can be numerical or string values. When used on string values, the comparisons are based on the standard lexicographical (alphabetic) ordering.&lt;br /&gt;&lt;br /&gt;== "Equal to" returns true if operands are equal. &lt;br /&gt;!= "Not equal to" returns true if operands are not equal. &lt;br /&gt;&gt; "Greater than" returns true if left operand is greater than right operand. &lt;br /&gt;&gt;= "Greater than or equal to" returns true if left operand is greater than or equal to right operand. &lt;br /&gt;&lt; "Less than" returns true if left operand is less than right operand.  &lt;br /&gt;&lt;= "Less than or equal to" returns true if left operand is less than or equal to right operand. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;boolean&lt;br /&gt;Boolean operators are typically used to combine multiple comparisons into a conditional expression. For example, you might want to test whether (total&gt;100) AND (stateTax=true). A boolean operator takes two operands, each of which is a true or false value, and returns a true or false result.&lt;br /&gt;&lt;br /&gt;&amp;&amp; "And" returns true if both operands are true. &lt;br /&gt;|| "Or" returns true if either operand is true. &lt;br /&gt;! "Not" returns true if the negation of the operand is true (e.g. the operand is false). &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;string&lt;br /&gt;Strings can be compared using the comparison operators. Additionally, you can concatenate strings using the + operator.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;"dog" + "bert" &lt;br /&gt; yields &lt;br /&gt; "dogbert" &lt;br /&gt; &lt;br /&gt;&lt;br /&gt;assignment&lt;br /&gt;The assignment operator (=) lets you assign a value to a variable. You can assign any value to a variable, including another variable (whose value will be assigned). Several shorthand assignment operators allow you to perform an operation and assign its result to a variable in one step.&lt;br /&gt;&lt;br /&gt;= Assigns the value of the righthand operand to the variable on the left. &lt;br /&gt;Example: total=100; &lt;br /&gt;Example: total=(price+tax+shipping) &lt;br /&gt;+= &lt;br /&gt;(also -=, *=, /=) Adds the value of the righthand operand to the lefthand variable. &lt;br /&gt;Example: total+=shipping (adds value of shipping to total and assigned result to total) &lt;br /&gt;&amp;= &lt;br /&gt;(also |=) Assigns result of (lefthand operand &amp;&amp; righthand operand) to lefthand operand. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;  &lt;br /&gt;&lt;br /&gt;special &lt;br /&gt;Several JavaScript operators, rarely used, fall into no particular category. These operators are summarized below.&lt;br /&gt;&lt;br /&gt;Conditional operator &lt;br /&gt;&lt;br /&gt;(condition) ? trueVal : falseVal  Assigns a specified value to a variable if a condition is true, otherwise assigns an alternate value if condition is false. &lt;br /&gt;Example: &lt;br /&gt;preferredPet = (cats &gt; dogs) ? "felines" : "canines" &lt;br /&gt;&lt;br /&gt;If (cats&gt;dogs), preferredPet will be assigned the string value "felines," otherwise it will be assigned "canines".  &lt;br /&gt;typeof operand Returns the data type of operand. &lt;br /&gt;Example -- test a variable to determine if it contains a number: &lt;br /&gt;if (typeof total=="number") ... &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;regular expressions (Netscape &amp; MSIE 4)&lt;br /&gt;New to JavaScript 1.2 is support for regular expressions, which are defined patterns used to match character combinations appearing in string values. Regular expressions are very powerful, potentially allowing you to search for any conceivable character pattern. However, they can also be quite complex to construct. Because regular expressions are widely supported in all high-level development environments, it is advised that you consider learning about regular expressions as a subject unto itself.&lt;br /&gt;&lt;br /&gt;Two detailed explanations of regular expressions can be found at&lt;br /&gt;&lt;br /&gt;Netscape's JavaScript Guide: Chapter 9 Expressions and Operators &lt;br /&gt;PERL5 Regular Expression Description&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7722578078463485731-5199575508153801064?l=javascriptfaqs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascriptfaqs.blogspot.com/feeds/5199575508153801064/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7722578078463485731&amp;postID=5199575508153801064' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7722578078463485731/posts/default/5199575508153801064'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7722578078463485731/posts/default/5199575508153801064'/><link rel='alternate' type='text/html' href='http://javascriptfaqs.blogspot.com/2008/08/operators.html' title='Operators'/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</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><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7722578078463485731.post-701419283427829173</id><published>2008-08-06T07:14:00.002-07:00</published><updated>2008-12-23T21:48:13.486-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Script'/><title type='text'>Variables and Data Types</title><content type='html'>Variables store and retrieve data, also known as "values". A variable can refer to a value which changes or is changed. Variables are referred to by name, although the name you give them must conform to certain rules. A JavaScript identifier, or name, must start with a letter or underscore ("_"); subsequent characters can also be digits (0-9). Because JavaScript is case sensitive, letters include the characters "A" through "Z" (uppercase) and the characters "a" through "z" (lowercase). Typically, variable names are chosen to be meaningful regarding the value they hold. For example, a good variable name for containing the total price of goods orders would be total.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;scope&lt;br /&gt;&lt;br /&gt;When you assign a new variable to an initial value, you must consider the issue of scope. A variable may be scoped as either global or local. A global variable may be accessed from any JavaScript on the page. A local variable may only be accessed from within the function in which it was assigned.&lt;br /&gt;&lt;br /&gt;Commonly, you create a new global variable by simply assigning it a value:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;newVariable=5;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;However, if you are coding within a function and you want to create a local variable which only scopes within that function you must declare the new variable using the var statement:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;function newFunction()&lt;br /&gt;{ var loop=1;&lt;br /&gt;  total=0;&lt;br /&gt;  ...additional statements... &lt;br /&gt;}&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;In the example above, the variable loop will be local to newFunction(), while total will be global to the entire page.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;type&lt;br /&gt;&lt;br /&gt;A value, the data assigned to a variable, may consist of any sort of data. However, JavaScript considers data to fall into several possible types. Depending on the type of data, certain operations may or may not be able to be performed on the values. For example, you cannot arithmetically multiply two string values. Variables can be these types: &lt;br /&gt;&lt;br /&gt;Numbers &lt;br /&gt; 3 or 7.987, Integer and floating-point numbers. &lt;br /&gt;&lt;br /&gt;Integers can be positive, 0, or negative; Integers can be expressed in decimal (base 10), hexadecimal (base 16), and octal (base 8). A decimal integer literal consists of a sequence of digits without a leading 0 (zero). A leading 0 (zero) on an integer literal indicates it is in octal; a leading 0x (or 0X) indicates hexadecimal. Hexadecimal integers can include digits (0-9) and the letters a-f and A-F. Octal integers can include only the digits 0-7. &lt;br /&gt;A floating-point number can contain either a decimal point, an "e" (uppercase or lowercase), which is used to represent "ten to the power of" in scientific notation, or both. The exponent part is an "e" or "E" followed by an integer, which can be signed (preceded by "+" or "-"). A floating-point literal must have at least one digit and either a decimal point or "e" (or "E"). &lt;br /&gt; &lt;br /&gt;Booleans &lt;br /&gt; True or False. The possible Boolean values are true and false. These are special values, and are not usable as 1 and 0. In a comparison, any expression that evaluates to 0 is taken to be false, and any statement that evaluates to a number other than 0 is taken to be true. &lt;br /&gt;Strings &lt;br /&gt; "Hello World !" Strings are delineated by single or double quotation marks. (Use single quotes to type strings that contain quotation marks.) &lt;br /&gt;Objects &lt;br /&gt; myObj = new Object(); &lt;br /&gt;Null &lt;br /&gt; Not the same as zero - no value at all. A null value is one that has no value and means nothing. &lt;br /&gt;Undefined &lt;br /&gt; A value that is undefined is a value held by a variable after it has been created, but before a value has been assigned to it. &lt;br /&gt;&lt;br /&gt;&lt;br /&gt;That said, JavaScript is a loosely typed language -- you do not have to specify the data type of a variable when you declare it, and data types are converted automatically as needed during script execution. By and large, you may simply assign any type of data to any variable. The only time data typing matters is when you need to perform operations on the data. Certain operators behave differently depending on the type of data being deal with. For example, consider the + operator:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;"5" + "10" &lt;br /&gt; yields &lt;br /&gt; "510" (string concatenation) &lt;br /&gt; &lt;br /&gt;5 + 10 &lt;br /&gt; yields &lt;br /&gt; 15 (arithmetic sum)&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7722578078463485731-701419283427829173?l=javascriptfaqs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascriptfaqs.blogspot.com/feeds/701419283427829173/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7722578078463485731&amp;postID=701419283427829173' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7722578078463485731/posts/default/701419283427829173'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7722578078463485731/posts/default/701419283427829173'/><link rel='alternate' type='text/html' href='http://javascriptfaqs.blogspot.com/2008/08/variables-and-data-types.html' title='Variables and Data Types'/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</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><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7722578078463485731.post-8260997394689025835</id><published>2008-08-06T07:14:00.001-07:00</published><updated>2008-12-23T21:48:13.486-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Script'/><title type='text'>JavaScript Grammar</title><content type='html'>JavaScript code, much like other programming languages, is made up of statements which serve to make assignments, compare values, and execute other sections of code. By and large, programmers will already be familiar with JavaScript's usage of variables, operators, and statements. Below is a chart summarizing the main elements of JavaScript grammar. Following, we will look at each element in detail.&lt;br /&gt;&lt;br /&gt;Variables &lt;br /&gt; Labels which refer to a changeable value. &lt;br /&gt;Example: total may be possess a value of 100. &lt;br /&gt;Operators &lt;br /&gt; Actors which can be used to calculate or compare values. &lt;br /&gt;Example: Two values may be summed using the addition operator (+); total+tax &lt;br /&gt;Example: Two values may be compared using the greater-than operator (&gt;); total&gt;200 &lt;br /&gt;Expressions &lt;br /&gt; Any combination of variables, operators, and statements which evaluate to some result. In English parlance this might be termed a "sentence" or even a "phrase", in that grammatical elements are combined into a cogent meaning. &lt;br /&gt;Example: total=100; &lt;br /&gt;Example: if (total&gt;100)  &lt;br /&gt;Statements &lt;br /&gt; As in English, a statement pulls all grammatical elements together into a full thought. JavaScript statements may take the form of conditionals, loops, or object manipulations. It is good form to separate statements by semicolons, although this is only mandatory if multiple statements reside on the same line. &lt;br /&gt;Example: if (total&gt;100) {statements;} else {statements;} &lt;br /&gt;Example: while (clicks&lt;10) {statements;} &lt;br /&gt;Objects &lt;br /&gt; Containing constructs which possess a set of values, each value reflected into an individual property of that object. Objects are a critical concept and feature of JavaScript. A single object may contain many properties, each property which acts like a variable reflecting a certain value. JavaScript can reference a large number of "built-in" objects which refer to characteristics of a Web document. For instance, the document object contains properties which reflect the background color of the current document, its title, and many more. For a fuller explanation of the built-in objects of JavaScript, see the section on "Document Object Model". &lt;br /&gt;Functions and Methods &lt;br /&gt; A JavaScript function is quite similar to a "procedure" or "subroutine" in other programming languages. A function is a discrete set of statements which perform some action. It may accept incoming values (parameters), and it may return an outgoing value. A function is "called" from a JavaScript statement to perform its duty. A method is simply a function which is contained in an object. For instance, a function which closes the current window, named close(), is part of the window object; thus, window.close() is known as a method.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7722578078463485731-8260997394689025835?l=javascriptfaqs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascriptfaqs.blogspot.com/feeds/8260997394689025835/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7722578078463485731&amp;postID=8260997394689025835' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7722578078463485731/posts/default/8260997394689025835'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7722578078463485731/posts/default/8260997394689025835'/><link rel='alternate' type='text/html' href='http://javascriptfaqs.blogspot.com/2008/08/javascript-2.html' title='JavaScript Grammar'/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</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><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7722578078463485731.post-562437856705599854</id><published>2008-08-06T07:13:00.000-07:00</published><updated>2008-12-23T21:48:13.486-08:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Java Script'/><title type='text'>JavaScript Tutorial for Programmers </title><content type='html'>&lt;br /&gt;JavaScript code is typically embedded into an HTML document using the SCRIPT tag. You are free to embed as many scripts into a single document as you like, using multiple SCRIPT tags. A script embedded in HTML with the SCRIPT tag uses the format:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;script language="JavaScript"&gt;&lt;br /&gt;&lt;!--&lt;br /&gt;document.write("Hello World!");&lt;br /&gt;//--&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;The LANGUAGE attribute is optional, but recommended. You may specify that a section of code only be executed by browsers which support a particular version of JavaScript; for instance:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;script language="JavaScript1.2"&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;Another attribute of the SCRIPT tag, SRC, can be used to include an external file containing JavaScript code rather than code embedded into the HTML:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;script language="JavaScript" src="corefunctions.js"&gt;&lt;br /&gt;&lt;/script&gt;&lt;br /&gt; &lt;br /&gt;&lt;br /&gt;The external file is simply a text file containing JavaScript code, and whose filename ends with the extension ".js". Note that although some version 3 browsers support the SRC attribute, it only functions reliably across platforms in the version 4 browsers.&lt;br /&gt;&lt;br /&gt;Scripts can be placed inside comment fields to ensure that your JavaScript code is not displayed by old browsers that do not recognize JavaScript. The markup to begin a comment field is &lt;!-- while you close a comment field using //--&gt;. This practice is certainly optional, but considered good form when your page is likely to be visited by older browsers. Certainly, as older browsers fade away, this practice will likely become unnecessary.&lt;br /&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/7722578078463485731-562437856705599854?l=javascriptfaqs.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://javascriptfaqs.blogspot.com/feeds/562437856705599854/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=7722578078463485731&amp;postID=562437856705599854' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7722578078463485731/posts/default/562437856705599854'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7722578078463485731/posts/default/562437856705599854'/><link rel='alternate' type='text/html' href='http://javascriptfaqs.blogspot.com/2008/08/javascript-tutorial-for-programmers.html' title='JavaScript Tutorial for Programmers '/><author><name>Siebel Expert</name><uri>http://www.blogger.com/profile/11533458660230230361</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><thr:total>1</thr:total></entry></feed>
