diff --git a/class4.html b/class4.html index 9fc1fc1..b8e8444 100644 --- a/class4.html +++ b/class4.html @@ -215,7 +215,6 @@

Submit buttons

event.preventDefault(); var temperature = document.getElementById('temp').value; console.log (temperature); - return false; } @@ -248,7 +247,7 @@

setInterval

For example, this is a simple clock:


-var simpleClock=setInterval(function(){myClock()},1000);
+var simpleClock=setInterval(myClock, 1000);
 function myClock() {
     var d = new Date();
     var t = d.toLocaleTimeString();
@@ -279,7 +278,7 @@ 

setTimeout


 var helloBox;
 function sayHello() {
-    helloBox=setTimeout(function(){alert("Hello")},3000);
+    helloBox=setTimeout(function(){alert('Hello')},3000);
 }
 function dontSayIt() {
     clearTimeout(helloBox);
@@ -294,12 +293,12 @@ 

Animations

targetPic.onclick = function () { var leftMarginValue = 0 function increaseMargin() { - leftMarginValue++ // update parameter each time - targetPic.style.marginLeft = leftMarginValue + 'px' //set left margin - if (leftMarginValue === 200) // check finish condition - clearInterval(movePic); - } - var movePic = setInterval(function(){increaseMargin()}, 10) // update every 10ms + leftMarginValue++ // update parameter each time + targetPic.style.marginLeft = leftMarginValue + 'px' //set left margin + if (leftMarginValue === 200) // check finish condition { + clearInterval(movePic); + } + var movePic = setInterval(function(){increaseMargin()}, 10) // update every 10ms }
diff --git a/files/class4.zip b/files/class4.zip new file mode 100644 index 0000000..36ff40e Binary files /dev/null and b/files/class4.zip differ