function Task(id, message, created, finished, cancelled) {
this.Id = id;
this.Message = message;
this.Created = created || new Date();
this.Finished = finished || null;
this.Cancelled = cancelled || null;
}
Task.FromObject = function(data) {
return new Task(
data.Id,
data.Message,
data.Created,
data.Finished,
data.Cancelled
);
}
$(function() {
$('[id^="slider"]').each(function() {
var elWrap = $(this),
el = elWrap.find('img'),
indexImg = 1,
indexMax = el.length,
phase = 3000;
elWrap.append('<span class="next"></span><span class="prev"></span>');
var btnNext = elWrap.find('span.next'),
btnPrev = elWrap.find('span.prev');
btnNext.click(function() {
indexImg++;
if(indexImg > indexMax) {
indexImg = 1;
}
change (el, indexImg);
});
btnPrev.click(function() {
indexImg--;
if(indexImg < 1) {
indexImg = indexMax;
}
change (el, indexImg);
});
});
});
function change ($img, indexImg) {
$img.fadeOut(0);
$img.filter(':nth-child('+indexImg+')').fadeIn(0);
}
var items = document.getElementsByClassName('item');
for (var i = 0; i < items.length; i++) {
items[i].addEventListener('click', function () {
...
});
}
var today = new Date();
var then = new Date(today.getTime() + 2*60*60*24*1000);
document.getElementById('data').innerText = then.getDate();
var checked = document.querySelectorAll('input[type="checkbox"]:checked');
var sum = 0;
for (var i=0; i<checked.length; i++) {
sum += checked.item(i).value;
}
var checkboxes = document.querySelectorAll('input[type="checkbox"]');
var sum = 0;
for (var i=0; i<checkboxes.length; i++) {
if (checkboxes.item(i).checked == true)
sum += checkboxes.item(i).value;
}
<!DOCTYPE HTML>
<html>
<head>
<title>Тег INPUT, атрибут checked</title>
</head>
<body>
<form method="post" action="input5.php">
Какими языками вы владеете:<br>
<input type="checkbox" id="lan5" name="lan5" value="0" checked >русский
<input type="checkbox" id="lan1" name="lan1" value="2" >английский
<input type="checkbox" id="lan2" name="lan2" value="2">немецкий
<input type="checkbox" id="lan3" name="lan3" value="2">китайский
<input type="checkbox" id="lan4" name="lan4" value="2">арабский<br>
<input type="button" id="calculate" onclick="displayResult()" value="Расчитать ">
</form>
<div id="result"></div>
</body>
<script>
function displayResult (){
var checkboxes = document.querySelectorAll('input[type="checkbox"]:checked'),
result = 0;
for (var i=0; i<checkboxes.length; i++) {
result += parseInt(checkboxes.item(i).value, 10);
}
document.getElementById('result').innerHTML = result;
}
</script>
</html>
<script src="/js/jquery.min.js"></script>
<script src="/js/bootstrap.min.js"></script>