Skip to content

Commit

Permalink
Syntax fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Roenok committed Feb 13, 2015
1 parent 4602c92 commit f3d3f3d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions class4.html
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,6 @@ <h3>Submit buttons</h3>
event.preventDefault();
var temperature = document.getElementById('temp').value;
console.log (temperature);
return false;
}
</code></pre>
</section>
Expand Down Expand Up @@ -248,7 +247,7 @@ <h3>setInterval</h3>
</code></pre>
<p>For example, this is a simple clock:</p>
<pre><code>
var simpleClock=setInterval(function(){myClock()},1000);
var simpleClock=setInterval(myClock, 1000);
function myClock() {
var d = new Date();
var t = d.toLocaleTimeString();
Expand Down Expand Up @@ -279,7 +278,7 @@ <h3>setTimeout</h3>
<pre><code>
var helloBox;
function sayHello() {
helloBox=setTimeout(function(){alert("Hello")},3000);
helloBox=setTimeout(function(){alert('Hello')},3000);
}
function dontSayIt() {
clearTimeout(helloBox);
Expand All @@ -294,12 +293,12 @@ <h3>Animations</h3>
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
}
</code></pre>
</section>
Expand Down
Binary file added files/class4.zip
Binary file not shown.

0 comments on commit f3d3f3d

Please sign in to comment.