Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

example: https://elearn.uta.edu/bbcswebdav/pid-8014059-dt-content-rid-137679691_2/courses/2192-ADVANCED-WEB-DEVELOPMENT-24399-001/2192-ADVANCED-WEB-DEVELOPMENT-24399-001_ImportedContent_20190115125610/2182-ADVANCED-WEB-DEVELOPMENT-24778-001_ImportedContent_20180115070215/coffeeOrderForm_starting.htm INSY 4315 advanced web design Note 9 JavaScript 3: Chapters 9-10 break vs. continue break: terminate the entire loop continue: skip one round

example: https://elearn.uta.edu/bbcswebdav/pid-8014059-dt-content-rid-137679691_2/courses/2192-ADVANCED-WEB-DEVELOPMENT-24399-001/2192-ADVANCED-WEB-DEVELOPMENT-24399-001_ImportedContent_20190115125610/2182-ADVANCED-WEB-DEVELOPMENT-24778-001_ImportedContent_20180115070215/coffeeOrderForm_starting.htm

INSY 4315 advanced web design

Note 9

JavaScript 3: Chapters 9-10

  1. break vs. continue

break: terminate the entire loop

continue: skip one round of a loop

Try: What would the browser display if it executed the following script?

What about change the break to continue?

  1. Functions

Declear a function:

function function-name ( parameter list ) {

statements;

return expression;

}

In-class exercise 1: modify the exercise 2 in the last exercise to allow it to take an unknown number of grades, convert and output each one into a letter grade. Finally output the average numerical grade.

(Define a function convert_letterGrade(x) that convert a number grade x to a corresponding letter grade.)

In-class exercise 2: Display the factorial of 0 to 10 on the webpage.

  1. Define a function factorial(x) that calculates the factorial of x.
  2. Show a title for you page Factorials of 0 to 10.
  3. Scope rules (Fig. 9.9)

Global variable vs. local variable

  1. Input through forms: get input through the DOM model

var input = parseFloat(document.getElementById(ngrade).value);

Output the results to the web page through the DOM model

document.getElementById(results).innerHTML = output; //an HTML element e.g.

document.getElementById(total).value = total; //an input textbox form element

  1. Event driven programming

Add event handling to attributes:

onblur onfocus onchange onselect

onclick onsubmit

onload onunload

onmouseover onmouseout

for example,

onclick = gradeConvert(); >

window.addEventListener(load, event handler function, false);

In-class exercise 3: Modify the grade convert exercise to allow it to take a numerical grade, convert and output it into a letter grade. Design a form to take the grade input and show the converted letter grade when a button is clicked on.

(Define a function convert_letterGrade(x) that convert a number grade x to a corresponding letter grade.)

In-class exercise 4: Design and program the following Coffee order form. Show total cost when click the button.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions

Question

define the term outplacement

Answered: 1 week ago

Question

describe the services that an outplacement consultancy may provide.

Answered: 1 week ago