question archive MAC172 Chapter 4: Practice Lab 1   Question 1: In HTML page, insert a JavaScript code that prompts the user to enter three values (name, age, and major) and save them in three variables and then print the values using document write method

MAC172 Chapter 4: Practice Lab 1   Question 1: In HTML page, insert a JavaScript code that prompts the user to enter three values (name, age, and major) and save them in three variables and then print the values using document write method

Subject:Computer SciencePrice: Bought3

MAC172

Chapter 4: Practice Lab 1

 

Question 1: In HTML page, insert a JavaScript code that prompts the user to enter three values (name, age, and major) and save them in three variables and then print the values using document write method.

 

Sample output: name is Mike, age is 30, and major is CS

Question 2: Update question #1 by moving the JavaScript code into external file and then link it to your html page.

Question 3: In HTML page, insert a JavaScript code that asks the if the user wants to continue to the next page. Save the user’s answer to a variable and then print its value using alert method.

 

 

Question 4: In HTML page, insert a JavaScript code that prompts the user to enter the temperature value in Fahrenheit. Converts the temperature from Fahrenheit to Celsius and print out both values using document write method.

 

Note: you can use this equation for converting from Fahrenheit to Celsius: C

Celsius= (5/9) * (fahrenheit-32);

 

Sample output: temperature in Fahrenheit=55 and the value in Celsius= 12.777777777777779

 

Question 5: In HTML page, suppose that you have the following a JavaScript code:

 

1. var z = 5, r;

r = (++z) + 5;

 

2. var f = 5, e;

e = (f++) + 5;

 

3. var a = 2,

b = 4,

c,

d;

 

c = 3 + a * b;

d = b / a / 2;

 

What are the values of r, e, c, and d variables?

Try to answer the question by:

1. Calculating the results manually.

2. Confirm your results by using the document method to print the results of r, e, c, and d values.

pur-new-sol

Purchase A New Answer

Custom new solution created by our subject matter experts

GET A QUOTE

Related Questions