JavaScript -Control Statements 2

JavaScript -Control Statements 2 - Chapter 9 - JavaScript:...

Info iconThis preview shows pages 1–9. Sign up to view the full content.

View Full Document Right Arrow Icon
Chapter 9 - JavaScript: Control Statements II Outline 9.1 Introduction 9.2 Essentials of Counter-Controlled Repetition 9.3 for Repetition Statement 9.4 Examples Using the for Statement 9.5 switch Multiple-Selection Statement 9.6 do while Repetition Statement 9.7 break and continue Statements 9.8 Labeled break and continue Statements 9.9 Logical Operators 9.10 Summary of Structured Programming 9.11 Web Resources
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Objectives In this lesson, you will learn: To be able to use the for and do while repetition statements to execute statements in a program repeatedly. To understand multiple selection using the switch selection statement. To be able to use the break and continue program-control statements. To be able to use the logical operators.
Background image of page 2
9.1 Introduction Continuation of Chapter 8 Theory and principles of structured programming
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
9.2 Essentials of Counter- Controlled Repetition Counter-controlled repetition Name of a control Initial value Increment or decrement Final value
Background image of page 4
WhileCounter.html (1 of 2) 1 <?xml version =  "1.0" ?>  2 <!DOCTYPE html PUBLIC  "-//W3C//DTD XHTML 1.0 Strict//EN"  3     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" 4   5 <!-- Fig. 9.1: WhileCounter.html   -->  6 <!-- Counter-Controlled Repetition -->  7   8 <html xmlns =  "http://www.w3.org/1999/xhtml" 9    <head>     10       <title> Counter-Controlled Repetition </title>  11   12       <script type =  "text/javascript" 13           <!--  14           var  counter =  1 ;             // initialization        15   16           while  ( counter <=  7  ) {     // repetition condition  17             document.writeln(  "<p style = \"font-size: "  +   18                counter +  "ex\">XHTML font size "  + counter +   19                 "ex</p>"  );  20             ++counter;                // increment  21          }  22           // -->  23       </script>  24  
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
WhileCounter.html (2 of 2) 25    </head><body></body>  26 </html> 
Background image of page 6
9.3 for Repetition Statement for repetition statement Handles all the details of counter- controlled repetition for structure header The first line
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
ForCounter.html (1 of 1) 1 <?xml version =  "1.0" ?>  2 <!DOCTYPE html PUBLIC  "-//W3C//DTD XHTML 1.0 Strict//EN"  3     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd" 4   5 <!-- Fig. 9.2: ForCounter.html                        -->  6 <!-- Counter-Controlled Repetition with for statement -->  7   8 <html xmlns =  "http://www.w3.org/1999/xhtml" 9    <head>  10       <title> Counter-Controlled Repetition </title>  11   12       <script type =  "text/javascript" 13           <!--  14          // Initialization, repetition condition and  
Background image of page 8
Image of page 9
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 54

JavaScript -Control Statements 2 - Chapter 9 - JavaScript:...

This preview shows document pages 1 - 9. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online