Home »
Articles posted by evirtualguru_ajaygour (Page 1390)
A loop is a series of statements that executes repeatedly, allowing you to perform iterative operations within your script. JavaScript and JScript statements that support looping logic include the for, while, do…while, label, break, and continue statements. The nice thing about loops is that they enable you to write just a few line of code and then to execute them repeatedly, making your scripts easier to write and maintain....
Continue reading »
October 16, 2015 evirtualguru_ajaygourOnline Computer EducationNo Comment
Comment statements have no effect on the logical performance of the script. However, they can be used to make scripts easier to understand by providing you with a means of internally documenting your scripts. You can place a comment in your scripts in either of two ways. To place a single comment line within the body of your script, type // followed by your comment, as shown here: //This...
Continue reading »
October 16, 2015 evirtualguru_ajaygourOnline Computer EducationNo Comment
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 »
October 16, 2015 evirtualguru_ajaygourOnline Computer EducationNo Comment
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 »
October 16, 2015 evirtualguru_ajaygourOnline Computer EducationNo Comment
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 »
October 16, 2015 evirtualguru_ajaygourOnline Computer EducationNo Comment
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 »
October 16, 2015 evirtualguru_ajaygourOnline Computer EducationNo Comment
As you know, there are two places you can put your JavaScripts in an HTML page: in either the head or body section. In addition, I have told you that you can either embed JavaScript directly into the HTML page or reference it in as an external .js file. One more way you can integrate JavaScript into an HTML page is as a component in an HTML tag. Placing JavaScripts...
Continue reading »
October 16, 2015 evirtualguru_ajaygourOnline Computer EducationNo Comment
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 »
October 16, 2015 evirtualguru_ajaygourOnline Computer EducationNo Comment