Q3 Computer 10 Week 5
Q3 Computer 10 Week 5
3RD Quarter
Lesson 5:
PREPARING AND INTERPRETING TECHNICAL DRAWING
Learning Competencies
Create a program with proper logical flow using
Quarter 3 control structures
WEEK 5 Show and perform a process accurately by
interpreting its illustration or drawing.
Introduction
Learning Objectives/Outcomes:
Lesson Proper:
In JavaScript you can create dialog boxes or popups to interact with the
user. You can either use them to notify a user or to receive some kind of user
input before proceeding.
Alert
Confirm
Prompt
ALERT BOX
COMPUTER 10 Page 1
An alert dialog box is the most simple dialog box. It enables you to display a
short message to the user. It also includes OK button, and the user has to click
this OK button to continue.
An alert dialog box is mostly used to give a warning message to the users.
For example, if one input field requires to enter some text but the user does not
provide any input, then as a part of validation, you can use an alert box to give
a warning message.
You can create alert dialog boxes with the alert() method.
Syntax:
alert("message");
sample code:
<script>
alert("Hello!");
</script>
CONFIRM BOXES
You can create confirm dialog boxes with the confirm() method.
Syntax:
confirm("message");
sample code:
<script>
</script>
PROMPT BOX
You can create prompt dialog boxes with the prompt() method.
COMPUTER 10 Page 2
This method returns the text entered in the input field when the user
clicks the OK button, and null if user clicks the Cancel button. If the
user clicks OK button without entering any text, an empty string is
returned.
Syntax:
prompt("message");
sample code:
<script>
</script>
JAVASCRIPT FUNCTIONS
Syntax:
function <function-name>(parameter)
{
// code to be executed
}
<function-name>();
Sample code:
<script>
function greet()
{
alert("Welcome to JavaScript Functions");
}
</script>
<body>
<button onclick = "greet()"> click me </button>
</body>
Analysis:
COMPUTER 10 Page 3
function greet() is a user defined function, or is a customized function
created by the programmer
alert(“Welcome to JavaScript Functions”) is a statement that executes
whenever function greet() is called
<button onClick =”greet”> calls the function greet() and therefore
executes the alert box.
Sample code 2:
<script>
function displayInfo()
</script>
<body>
</body>
https://js.do/
NAME: __________________________________
COMPUTER 10 Page 4
SECTION: _______________________________
EXERCISES/ACTIVITIES:
Activity 1: What is the output of the code below?. Paste your answer on
the box
<script>
ShowMessage("Steve", "Jobs");
ShowMessage("Bill", "Gates");
ShowMessage(100, 200);
</script>
Identification.
_______1. A pop up box that is used if the user needs to verify or accept
something
_______2. Used to notify or give warning to the user such as incomplete
input or leaving some fields or text box in a form.
_______3. Sets of codes that do a certain task.
_______4. Used if the user needs to verify or accept something.
_______5. Used if there is a need to get input from the user.
COMPUTER 10 Page 5