Home » Posts tagged "Learn Java Script Online" (Page 2)

Learn Java Script, The switch Statement, Lesson No. 20

  The switch statement evaluates a series of conditional tests or cases and executes additional statements based on whether the case proves true. The syntax of the switch statement is shown here: switch (expression) { case label: statements; break; . . . case label: statements; break; default: statements; } The switch statement compares the result of the expression against the label for each case. The statements for the first case that...
Continue reading »

Learn Java Script, JavaScript and JScript Statements, The If Statements, Loops and Switch, Lesson No. 19

    JavaScripts and JScripts consist of a series of statements. These statements are the programming instructions, or logic, that you write to tell the scripts what you want them to do. Using Conditional Statements to Alter Script Flow Conditional statements enable you to test for various conditions and take action based on the results of the test. Specifically, conditional statements execute when the tested condition proves to be true. Conditional...
Continue reading »

Learn Java Script, The Math Object, Lesson No. 18

    Having introduced you to the String object, it seems only proper at this point in the discussion that I talk a little about the Math object as well. This object is created automatically in every JavaScript and JScript, so you do not have to create an instance of it as you do with the String object. You can simply refer to the Math object when you need to. Like...
Continue reading »

Lean Java Script, Referencing JavaScript in an External .js File, Lesson No. 17

      To store your JavaScripts in external files, you need to save them as plain text files with a .js file extension. You then need to add the SCR attribute to the opening <SCRIPT> tag in your HTML page as demonstrated here. <SCRIPT SRC=”Test.js” LANGUAGE=”JavaScript” TYPE=”Text/JavaScript”> </SCRIPT> In this example, an external JavaScript named Test.js has been specified. This external JavaScript can contain any number of JavaScript statements. However,...
Continue reading »

Learn Java Script, Writing Text with Strings, Lesson No. 15

  We have spent a lot of time already this morning learning about how to work with values. One object in particular, the String object, you will find yourself using over and over again in your scripts. I thought I’d spend a little time going over the String object now, even though the lesson on JavaScript and JScript objects isn’t until this later this morning. Consider this a sneak preview. The...
Continue reading »

Learn How to Compare Values in Java Script, Lesson 14

  Comparing Values One of the things you will find yourself doing in your scripts is comparing the values of variables. For example, you might take one action if a variable has a value less than 10 and a different action when the variable is greater than 10. Table 2.4 provides a list of JavaScript and JScript comparison operators you can use in your scripts. JAVASCRIPT AND JSCRIPT COMPARISON OPERATORS The...
Continue reading »

Learn How to Global Variable Create in Java Script, Lesson 11

  Global Variables in Java Script. A global variable is any variable defined outside of a function. Such a variable is global because any script statement located in the Web page or script file can refer to it. You can create a global variable in several ways, including: Creating the variable by referencing it inside a function without first declaring it using the var keyword. Creating the variable anywhere else in...
Continue reading »