Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Скачиваний:
33
Добавлен:
17.03.2016
Размер:
177.64 Кб
Скачать

Java Script

Questions

What is js designed for?

What do you need to know to work with js?

How does it works?

What is js designed for?

Java script is a programming language which is most commonly used as part of web browser to interact with the user and alter the document content which is displayed.

Java script also used for web, game development, mobile and desktop applications.

What is js designed for?

Interaction

Validation

Motion

Calculations

Graphics etc.

Required skills

HTML

CSS

How does js works

Web-client fetches a script

Waits for event

Executes a script

Js example

<!DOCTYPE html> <html>

<body>

<h1>JavaScript Can Change Images</h1>

<img id="myImage" onclick="changeImage()" src="ball1.jpg" width="128" height="128">

<p>Click the ball to change it's color.</p> </body>

</html>

Js example

<script>

var count = 1;

function changeImage() { count = count++ % 3 + 1;

var image = document.getElementById('myImage'); image.src = "ball" + count + ".jpg";

}

</script>

Js example

<!DOCTYPE html> <html>

<body>

<h1>JavaScript Can Change Images</h1>

<img id="myImage" onclick="changeImage()" src="ball1.jpg" width="128" height="128"> <p>Click the ball to change it's color.</p>

<script>

var count = 1;

function changeImage() { count = count++ % 3 + 1;

var image = document.getElementById('myImage'); image.src = "ball" + count + ".jpg";}

</script>

</body>

</html>

Js example

<!DOCTYPE html> <html>

<head>

<script type="text/javascript" src="balls-script.js"></script> </head>

<body>

<h1>JavaScript Can Change Images</h1>

<img id="myImage" onclick="changeImage()" src="ball1.jpg" width="128" height="128">

<p>Click the ball to change it's color.</p> </body>

</html>

Соседние файлы в папке 07.08.2015.JavaScript