2_Computer science grade 10Using Scripts_presentation1_2 variant

  • ppt
  • 09.05.2020
Публикация на сайте для учителей

Публикация педагогических разработок

Бесплатное участие. Свидетельство автора сразу.
Мгновенные 10 документов в портфолио.

Иконка файла материала 2_Computer science grade 10Using Scripts_presentation1_2 variant.ppt

Using Scripts

10.4.2.3 use ready-made scripts in web-development

CS380

1

JAVASCRIPT

JavaScript is used in millions of Web pages to improve the design, validate forms, detect browsers, create cookies, and much more.
JavaScript is the most popular scripting language on the internet, and works in all major browsers, such as Internet Explorer, Mozilla, Firefox, Netscape, Opera.

WHAT IS JAVASCRIPT?

JavaScript was designed to add interactivity to HTML pages
JavaScript is a scripting language (a scripting language is a lightweight programming language)
A JavaScript consists of lines of executable computer code
A JavaScript is usually embedded directly into HTML pages
JavaScript is an interpreted language (means that scripts execute without preliminary compilation)
Everyone can use JavaScript without purchasing a license

How to Put a JavaScript Into an HTML Page?





JavaScript Variables

Variables are used to store data.
A variable is a "container" for information you want to store. A variable's value can change during the script. You can refer to a variable by name to see its value or to change its value.
Rules for variable names:
Variable names are case sensitive
They must begin with a letter or the underscore character
strname – STRNAME (not same)

JavaScript Basic Examples

 format text with HTML code - heading

Example



 use line break html code

Conditional Statements

Very often when you write code, you want to perform different actions for different decisions. You can use conditional statements in your code to do this.

In JavaScript we have the following conditional statements:
if statement - use this statement if you want to execute some code only if a specified condition is true
if...else statement - use this statement if you want to execute some code if the condition is true and another code if the condition is false
if...else if....else statement - use this statement if you want to select one of many blocks of code to be executed
switch statement - use this statement if you want to select one of many blocks of code to be executed

Conditional Statements

if (condition)
{
code to be executed if condition is true
}


if (condition)
{
code to be executed if condition is true
}
else
{
code to be executed if condition is not true
}