<?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:blogger='http://schemas.google.com/blogger/2008' 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-1718426985779865874</id><updated>2024-09-07T23:26:31.222-07:00</updated><title type='text'>learn javascript</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://learnjavascript-on-line.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1718426985779865874/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://learnjavascript-on-line.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>ashraf ahmed</name><uri>http://www.blogger.com/profile/02691953703823099084</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>3</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-1718426985779865874.post-8498425944421299026</id><published>2011-02-25T11:49:00.001-08:00</published><updated>2011-02-25T11:49:33.989-08:00</updated><title type='text'></title><content type='html'>&lt;div dir=&quot;rtl&quot; style=&quot;text-align: right;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;text-align: left;&quot;&gt;             The final four statements actually update the value             stored in the &quot;a&quot; variable as well as the one             on the left of the assignment operator. I will explain             how this works by assuming that &quot;a&quot; starts             off as 5 in each case. The statement b = ++a first adds             1 to the value in &quot;a&quot; and then assigns that             value to &quot;b&quot; so both variables now contain 6.             The statement c = a++ first assigns the value from             &quot;a&quot; into &quot;c&quot; and then adds 1 to             &quot;a&quot; so now &quot;c&quot; contains 5 and             &quot;a&quot; contains 6. The statement d = --a             subtracts one from &quot;a&quot; and then assigns the             result to &quot;d&quot; so both variables now contain             4. I&#39;ll leave it for you to figure out what values             &quot;a&quot; and &quot;e&quot; end up with after the             last statement executes.           &lt;/div&gt;&lt;div&gt;           &lt;/div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;             Combination Operators           &lt;/h3&gt;&lt;div style=&quot;text-align: left;&quot;&gt;           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;             Next we&#39;ll look at some more assignment operators.             Like the basic assignment operator these also assign a             new value to the variable to the left of the operator             but with these the original value is not lost but is             used in calculating the new value to be stored. Here             are some examples:           &lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnjavascript-on-line.blogspot.com/feeds/8498425944421299026/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnjavascript-on-line.blogspot.com/2011/02/final-four-statements-actually-update.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1718426985779865874/posts/default/8498425944421299026'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1718426985779865874/posts/default/8498425944421299026'/><link rel='alternate' type='text/html' href='http://learnjavascript-on-line.blogspot.com/2011/02/final-four-statements-actually-update.html' title=''/><author><name>ashraf ahmed</name><uri>http://www.blogger.com/profile/02691953703823099084</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1718426985779865874.post-8666104418215213066</id><published>2011-02-25T11:48:00.001-08:00</published><updated>2011-02-25T11:48:33.282-08:00</updated><title type='text'></title><content type='html'>&lt;div dir=&quot;rtl&quot; style=&quot;text-align: right;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;text-align: left;&quot;&gt;             With this version of the script we no longer have the             text to be displayed contained within the             document.write statement. Instead we first define a             variable called &lt;b&gt;hello&lt;/b&gt; which we assign the value             &quot;Hello World&quot; to and then we write out the             content of the variable instead of static text.           &lt;/div&gt;&lt;div&gt;           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;             This doesn&#39;t produce any different result on the             page but the differences in the code introduce you to a             number of new features of Javascript. This will also             allow us to insert further statements into this             Javascript code at a later date that will change the             value of the variable before it is displayed on the             page.           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;             The first line in this script creates our first             variable. To create a variable you specify &lt;b&gt;var&lt;/b&gt;             (for variable) followed by the name that we want to use             for the variable. If we want to give the variable a             value straight away then we follow the name with equals             (=) and then the value that we want to use. We call             this initializing the variable.           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;             It is possible to define a new variable without             preceding the variable name with var. Specifying a new             variable name without the var in front will still             result in a variable with the specified name being             created (if one doesn&#39;t already exist). I recommend             however that you always use var when you intend to             define a new variable. In a later tutorial I will show             you how you can create two variables with the same name             but different scope (this means that only one is             accessible at a time and where you are in the code             determines which one you are referencing). If you leave             off var when defining new variables you run the risk of             using an existing variable instead of defining a new             one. Always specifying var when defining new variables             will also reduce the possibility that the variables you             use in multiple scripts on the same page will interfere             with one another.           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;           &lt;/div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;             Types of Variables           &lt;/h3&gt;&lt;div style=&quot;text-align: left;&quot;&gt;           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;             Javascript supports three types of simple variables.             These are text, numbers, and boolean (true or false).             In this case this variable is a text variable because             the value we have initialized it with is text (because             it is enclosed within apostrophes). Had we wanted to             define the variable as a number then we would have             given it a numeric value (not enclosed in apostrophes)             like this:           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;           &lt;/div&gt;&lt;div class=&quot;code&quot; style=&quot;text-align: left;&quot;&gt;             var mynum = 5;           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;             We could also have defined the variable as boolean by             assigning it an initial value of true or false. For             example:           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;           &lt;/div&gt;&lt;div class=&quot;code&quot; style=&quot;text-align: left;&quot;&gt;             var smokes = false;           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;             If you don&#39;t assign a value to the variable             straight away then the type of variable that it is will             be undefined until you give it a value.           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;             You can leave a variable undefined when you don&#39;t             want to assign it an initial value but a better             alternative where you don&#39;t want to give the             variable a value straight away is to specify that the             variable doesn&#39;t have a value at all. We do this by             initializing the variable with &lt;b&gt;null&lt;/b&gt; like this:           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;           &lt;/div&gt;&lt;div class=&quot;code&quot; style=&quot;text-align: left;&quot;&gt;             var riches = null;           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;             Javascript also allows you to define and use more             complex data types that are defined using classes.             We&#39;ll go into more detail about classes in a later             tutorial but here&#39;s an example of a variable             defined from a class so that you know what they look             like:           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;           &lt;/div&gt;&lt;div class=&quot;code&quot; style=&quot;text-align: left;&quot;&gt;             var today = new Date;           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;           &lt;/div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;             Naming Variables           &lt;/h3&gt;&lt;div style=&quot;text-align: left;&quot;&gt;           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;             So what should you call your variables? The best option             (at least to start with) is to use meaningful names for             all of your variables. If you call your variable             &lt;b&gt;openingPrice&lt;/b&gt; then you are far more likely to             remember what the field is used for when you need to             modify the script at a later date than if you call it             &lt;b&gt;op&lt;/b&gt;. The only restriction on what names you can             use for your variables is that you can&#39;t use             reserved words and all of the characters you use in the             variable names must be alphanumeric. Reserved words are             words that currently (or are expected in the future) to             have a special meaning in the Javascript programming             language. Examples of reserved words that you have             already met include &quot;var&quot;, &quot;true&quot;,             &quot;false&quot;, &quot;new&quot;, and             &quot;null&quot;. You&#39;ll find a complete list of             reserved words elsewhere on this site.           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;             Note that variable names cannot contain spaces. This             means that when you use multiple words in a variable             name that you must either separate the words with an             underscore character (the only non alphabetic and non             number character that nevertheless is considered to be             alphanumeric) - for example: opening_balance - or you             can do as I did in the previous paragraph and             capitalize the first letter of the second and             subsequent words. It doesn&#39;t matter which of these             two options you choose but I suggest that you use that             one consistently for your variable names rather than             switching between them.           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;           &lt;/div&gt;&lt;h3 style=&quot;text-align: left;&quot;&gt;             Using What You Know           &lt;/h3&gt;&lt;div style=&quot;text-align: left;&quot;&gt;           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;             Suppose that you have some web page content that             appears in multiple places on the page. If you will             need to update that repeating content then you will             need to make sure that you make the changes at each             spot in the page where the content appears. If you miss             one when updating it then the content will no longer             repeat correctly.           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;             If we use a Javascript variable to store the content             that is to be repeated then we can write that out to             the several places on the page where the content is             needed. If the content needs to be changed then you             change it once in the declaration of the variable and             all of the repetitions will reflect that change.           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;             Suppose that the code to be repeated reads as follows:           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;           &lt;/div&gt;&lt;div class=&quot;code&quot; style=&quot;text-align: left;&quot;&gt;             &amp;lt;p&amp;gt;If you have any questions about this&lt;br /&gt;
please &amp;lt;a             href=&quot;mailto:me@myaddress.com&quot;&amp;gt;email             me&amp;lt;/a&amp;gt;.&amp;lt;/p&amp;gt;           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;             This code might appear under each of say five separate             sections of text on your page. If your email address             were to change then you would need to update each spot             on the page to the new email address. If you miss one             then emails sent from that link will go to the wrong             address.           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;             So let&#39;s include that text into a Javascript             variable instead. We will replace the first occurrence             of the code with the following Javascript:           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;           &lt;/div&gt;&lt;div class=&quot;code&quot; style=&quot;text-align: left;&quot;&gt;             &amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&lt;br /&gt;
var questions = &#39;&amp;lt;p&amp;gt;If you have any questions             about this&lt;br /&gt;
&lt;img alt=&quot;continued from previous line&quot; height=&quot;17&quot; src=&quot;http://javascript.about.com/library/graphics/cont.gif&quot; width=&quot;17&quot; /&gt; please &amp;lt;a                  href=&quot;mailto:me@myaddress.com&quot;&amp;gt;email                  me&amp;lt;/a&amp;gt;.&amp;lt;/p&amp;gt;&#39;;&lt;br /&gt;
document.write(questions);&lt;br /&gt;
&amp;lt;/script&amp;gt;           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;             &lt;b&gt;Note:&lt;/b&gt; The line commencing with &lt;img alt=&quot;continued from previous line&quot; height=&quot;17&quot; src=&quot;http://javascript.about.com/library/graphics/cont.gif&quot; width=&quot;17&quot; /&gt; is a continuation of             the previous line and I have split it into two lines to             make it easier to read in browsers using lower screen             resolutions. When you copy the script you should place             the code on this line onto the end of the preceding             line.           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;             The other copies of the same code can be replaced with             the following Javascript which will use the variable             value previously assigned:           &lt;/div&gt;&lt;div style=&quot;text-align: left;&quot;&gt;           &lt;/div&gt;&lt;div class=&quot;code&quot; style=&quot;text-align: left;&quot;&gt;             &amp;lt;script type=&quot;text/javascript&quot;&amp;gt;&lt;br /&gt;
document.write(questions);&lt;br /&gt;
&amp;lt;/script&amp;gt;           &lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnjavascript-on-line.blogspot.com/feeds/8666104418215213066/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnjavascript-on-line.blogspot.com/2011/02/with-this-version-of-script-we-no.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1718426985779865874/posts/default/8666104418215213066'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1718426985779865874/posts/default/8666104418215213066'/><link rel='alternate' type='text/html' href='http://learnjavascript-on-line.blogspot.com/2011/02/with-this-version-of-script-we-no.html' title=''/><author><name>ashraf ahmed</name><uri>http://www.blogger.com/profile/02691953703823099084</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-1718426985779865874.post-5563321441150106355</id><published>2011-02-25T11:47:00.001-08:00</published><updated>2011-02-25T11:47:37.800-08:00</updated><title type='text'>Learn to Program with Javascript</title><content type='html'>&lt;div dir=&quot;rtl&quot; style=&quot;text-align: right;&quot; trbidi=&quot;on&quot;&gt;&lt;div style=&quot;text-align: left;&quot;&gt;You do not need prior programming experience to be able to follow this  tutorial series that takes you step by step through how to write your  own Javascript programs. No longer will you have to rely on pre-built  scripts written by others. You will be able to write your own scripts  that do exactly what you want them to do.&lt;/div&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://learnjavascript-on-line.blogspot.com/feeds/5563321441150106355/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://learnjavascript-on-line.blogspot.com/2011/02/learn-to-program-with-javascript.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/1718426985779865874/posts/default/5563321441150106355'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/1718426985779865874/posts/default/5563321441150106355'/><link rel='alternate' type='text/html' href='http://learnjavascript-on-line.blogspot.com/2011/02/learn-to-program-with-javascript.html' title='Learn to Program with Javascript'/><author><name>ashraf ahmed</name><uri>http://www.blogger.com/profile/02691953703823099084</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>