Javascript in HTML

अब Quizwiz के साथ अपने होमवर्क और परीक्षाओं को एस करें!

<button>

<button onclick= "addTwoNums()"> Click Me</button> The HTML tag ________ can be used to create a button that calls a JavaScript function when it is clicked.

testPara

In the example the <form> tag is used to create two input boxes on the web page. When the button is clicked the function called captureForm is called. The function reads the data from the form into an array. As there were two input boxes the array created has two elements. Each array element is read into a variable. These are concatenated along with a break <br> tag. Finally, the concatenated text is written back to the web page using the <p> tag with the id ________.

id

In the example the HTML paragraph <p> element is assigned an __ . This can be used in the code shown to write text from a variable into this element, causing it to be displayed on the web page.

<script>

JavaScript code is contained within the _______ HTML tag.

fixed

for (num=0; num<4; num++) { counter = counter + 1; } This is a _____ loop

function

function addTwoNums() { var num1 = 2; var num2 = 4; var total = num1 * num2; } A ________ can be created to modularise code. They can be called using code or events such as a button click.

parameters

function addTwoNums(num1,num2) { return num1 + num2; } total = addTwoNums(5,6); Using __________ , a function can be used to perform a calculation and return a result. The result can then be assigned to a variable as shown.

conditional

if (counter>10) {bonus = pay * 1.25}; This is a __________ statement

random

num = Math.random( ); Generates a _______ number between 0 and 1 and stores it in a variable.

round

num = Math.round(5.3); Used to _____ a number to the nearest integer.

min

num1 = Math.max(1,34,87,129,3,9); num2 = Math.min(1,34,87,129,3,9); The max and ___ functions will find the largest and smallest values in a list.

string

var answer = "Egypt" A _____ is assigned using " ".

array

var books = ["paperback", "hardback", "diary", "notebook"]; books[0] = "leaflet"; An _____ can be declared and assigned values as shown.

object

var game = {genre: "Action", age: "15", name: "Battle Droids"}; var gameTitle = game.name; An ______ is created to store the properties of a computer game. A full stop is used after the its name to access a specific property.

conditional

var num = 0; while (num<15) { total = total + num; num++; } This is a ___________ loop

case

var text = "Computing Higher"; var lower = text.toUpperCase; var upper = text.toLowerCase; These two functions will convert a string to lower or upper ____ characters.

length

var text = "Computing Higher"; var textLength = text.length; The ______ function can be used to determine the number of characters in a string.

assigned

var x; x = 5; x is declared as a variable and then ________ the value 5.


संबंधित स्टडी सेट्स

CISC 192 - MyProgrammingLab - Chapter 13

View Set

Chapter 2: Trends in HRM, HRIR 3021 (UMN-Peter Ronza)

View Set

The Legislative Branch: The Senate (Article 1,Section 3)

View Set

CH.7- Structuring System Process Requirements

View Set

Week 2- The Immune System Pharmacology ATI Questions (Exam 1)

View Set

Videbeck Psychiatric Mental Health Nursing Chapter 5 Therapeutic Relationships NCLEX

View Set