This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>Подключение внешнего JS</title> | |
<!-- | |
Атрибут src указывает путь в файлу с javascript кодом | |
Атрибут type в настоящее время является необязательным | |
--> | |
<script |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE HTML> | |
<html lang="ru-RU"> | |
<head> | |
<title>Переменные в JavaScript</title> | |
<meta charset="UTF-8"> | |
<script src="02.variables.js"></script> | |
</head> | |
<body> | |
<h1>Работа с переменными в JavaScript</h1> | |
</body> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Основные типы данных в JS | |
*/ | |
var sampleNumber, | |
anotherNumber, | |
sampleString, | |
anotherString, | |
itIsTrue, | |
itIsNotTrue, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<jdoc:include type="head" /> | |
</head> | |
<body> | |
<jdoc:include type="component" /> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def contacts(request): | |
persons = PersonToPosition.objects.all() | |
departments = {} | |
for person in persons: | |
department_id = person.position.department.id | |
if (department_id not in departments): | |
departments[department_id] = { | |
'title': person.position.department.title, | |
'id': department_id, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Условные конструкции и циклы | |
*/ | |
// 1. Оператор if | |
var time = 5; | |
if (time < 12) | |
{alert("Доброе утро!"); } | |
else | |
{alert("Добрый день!"); } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Функции | |
*/ | |
// 1. Определение и вызов функции | |
function yourMessage(){ | |
console.log("функция"); | |
} | |
yourMessage(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Массивы | |
*/ | |
// 1. Создание массива | |
var days = new Array(7); | |
days [0]="Понедельник"; | |
days [1]="Вторник"; | |
days [2]="Среда"; | |
days [3]="Четверг"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. Создание объекта | |
var person = new Object(); | |
person.firstname = "Анна"; | |
person.lastname = "Смирнова"; | |
alert(person.lastname); | |
// 2. Литеральная форма записи | |
var my_obj = { | |
x: 5, | |
y: 4, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 1. Создание объекта | |
var d = new Date(); | |
document.write(d); | |
document.write(d.getDay()); | |
document.write(d.getTime() + " milliseconds since 1970/01/01"); | |
// 2. Метода объекта Date | |
dateVar = new Date(); | |
alert("Время на вашем компьютере: " + dateVar.getHours() + ":" + dateVar.getMinutes() + ":" + dateVar.getSeconds() +":" + dateVar.getMilliseconds()); |