SCRIPTING LANGUAGE PROGRAMMING

| July 16, 2016

Paper , Order, or Assignment Requirements

EBI 102 – SCRIPTING LANGUAGE PROGRAMMING

ASSIGNMENT 2 – JavaScript Function

The purpose of this assignment is to gain practice working with JavaScript functions.

 

  1. Create a new external javascript file called myfunctions.js in Notepad++.
  2. In myfunctions.js write the following JavaScript function called printH1() to output a text value in a <h1> element.

function printH1( text ) {

document.write(“<h1>” + text + “</h1>”);

}

  1. In myfunctions.js write another JavaScript function called printParagraph() to output a text value in a <p> element. The function should take one parameter named text.
  2. In myfunctions.js write a JavaScript function named subtract() that subtracts two numbers. The function should have two parameters named x and y, and should return the value of variable named result that is equal to x – y.
  3. In myfunctions.js write a JavaScript function named CalcVol() to calculate the volume of a rectangular solid. The function should have three parameters named x, y and z, and should return the value of variable named Vol that is equal to x * y * z.
  4. Create a new .html file called test.html
  5. In the head section of test.html, insert a script element that accesses the code in the external

myfunctions.js file.

  1. Anywhere in the body of test.html, create a script element that contains the following:
  2. Declare a variable called TotalVolume
  3. Set TotalVolume to the result of the CalcVol() function with the parameters x = 20, y = 10, z = 3.
  4. Use document.write to output the value of the TotalVolume variable
  5. Use document.write to output the result of the subtract() function with x = 50 and y = 35.
  6. Call the printParagraph() function with the parameter A paragraph printed with JavaScript

Get a 5 % discount on an order above $ 150
Use the following coupon code :
2018DISC
Biblical worldview
Special Populations

Tags:

Category: Uncategorized

Our Services:
Order a customized paper today!