Concept explainers
In this case, defining the function is a technique that can be reusable in JavaScript code.
Hence, the correct answer is option “A”.
Explanation of Solution
Defining a function:
It is a technique which is used to perform the particular task when the function is called by user using its name. The function can be used multiple times by calling the function in JavaScript. So, the defined function can be reused in JavaScript code.
Explanation for incorrect options:
Create a script block:
In this option, creating a script is a block of code with “<script>” element. This block is used to write the set of code and the block is cannot be reused by the user.
Hence, the option “B” is wrong.
Define an “if” statement:
In this option, “if” statement is a conditional statement which is used to check the value of variable with its appropriate condition. If the condition returns true, then it displays the “true” block, otherwise it executes “false” block. So, it cannot be reused by user.
Hence, the option “C” is wrong.
Use an onclick event handler:
“Onclick” is an event handler which is processed when the user clicks on the event. It is a predefined technique and used for “click” event.
Hence, the option “D” is wrong.
Want to see more full solutions like this?
Chapter 14 Solutions
Web Development and Design Foundations with HTML5 (8th Edition)
- RECTANGLE PROBLEM Enter Length: Enter Width: Area: Perimeter: Area Perimeter |Both Clear 1. Add JavaScript to the square problem such that it computes the area, perimeter or both when the length and width are given and the appropriate button is pressed. Make sure to make all buttons functional. Rename to exam4sample21.html Input File: Output File: rectangle.html exam4sample21.html 2. Add input validation such that the proper error is generated when the input field is not a number. Rename to exam4sample22.html Use input form validation as follows: onclick="if(isInteger(ʻinputl')) compute('inputl');" function isInteger(id) var flag=true; var x=document.getElementById(id); if (x.value==nuii || x.value=="") else if (x.value==") else if (isNaN (x.value)) else if ((parseFloat (x.value))$1 !=® ) { alert("Value Is Not An Integer");flag=false;} return flag: { alert("Integer Field Empty");flag=false;} i alert("Value Not A Number"); flag=false;} Input File: Output File: exam4sample21.html…arrow_forwardTask: Write a program in JavaScript which takes three paragraphs as input and computes the following tasks. 1. Print all the words, each of which is present in all the three paragraphs. 2. Highest occurring word in the first paragraph. 3. Highest occurring word in the Second paragraph. 4. Highest occurring word in the Third paragraph. Important: ● CSCS 342: Web Application Development Assignment 2 ● Make a folder and rename it with your roll number only. Make an external JavaScript file and add all code in it. Rename it with your Name-Roll Number.js (else you will not get any marks for it) Take inputs and display result in a single HTML file. The name of your HTML file will be YourName_Roll No.htmlarrow_forwardIm creating a Web page that calculates a tip, total bill, and splits the bill based on user info. Javascript. See instructions.arrow_forward
- Internet Technologies Class.HTMLWrite a script that asks for a user's name and age, then prints the user's name and age on the screen over and over until it loops as many times as the user's age. Security Feature: Do not let users named "Raymond" run this programarrow_forward3) Write a java program for displaying one flag at a time from nine countries flags. You may have a base Form with nine buttons (you may use Listview to trigger the events as well or any other method) and upon clicking one of the buttons (or selecting Listview item, or Combo box item) with the country name on it the image box / Label icon should display the country flag.arrow_forwardDO NOT COPY FROM OTHER WEBSITES Code with comments and output screenshot is must for an Upvote. Thank you!!!arrow_forward
- Write a webpage with JavaScript code to perform the following tasks: answer all exercises.arrow_forwardCourse HTML Write a JavaScript function that accepts a number from a user as input and checks if the number is prime, then print True if the number is not a prime, print False.arrow_forwardAtp.arrow_forward
- Internet Technologies Class.HTMLWrite a script that asks for a user's name and age, then prints the user's name and age on the screen over and over until it loops as many times as the user's age. Security Feature: Do not let users named "Raymond" run this program.Do it by CSS language.arrow_forwardDefine the following. F (Message box- forecolor- Variables- Command button- input box- vbcritical,- Events)arrow_forwardWrite JavaFx Program : Create a text editor that will allow user to save and create text doc- ument. This text editor should have; i) a small permanent dictionary that can suggest words to user, ii) a temporary dictionary that would save the words used by user in current document and suggest words depending upon both of these dictionaries, iii) allow user to drag/drop charts and other stuff into your text editor (if it is possible but not required) iv) allow users to create their own charts/flow diagrams and you can keep adding functionality.arrow_forward
- New Perspectives on HTML5, CSS3, and JavaScriptComputer ScienceISBN:9781305503922Author:Patrick M. CareyPublisher:Cengage Learning