From 03c28c18d7095bc8cc9e2c96b3d7942147e318d7 Mon Sep 17 00:00:00 2001 From: ellery coleman Date: Wed, 9 Sep 2015 19:50:15 -0400 Subject: [PATCH 1/2] Implements assignment 0 within the index.html file. --- index.html | 59 +++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 56 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 4ef4a89..800da25 100644 --- a/index.html +++ b/index.html @@ -27,14 +27,67 @@

Hello World!

This is something!

- + Enter a number: + +
+ + - - + + From b13ae09fa3203218ac510d146a5b36aa0fa1665f Mon Sep 17 00:00:00 2001 From: ellery coleman Date: Wed, 9 Sep 2015 19:50:15 -0400 Subject: [PATCH 2/2] Implements assignment 0. Implements assignment 0 by modifying index.html and adding the appropriate javascript within assign0.js. --- assign0.js | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ index.html | 5 ++++- 2 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 assign0.js diff --git a/assign0.js b/assign0.js new file mode 100644 index 0000000..600a8ea --- /dev/null +++ b/assign0.js @@ -0,0 +1,50 @@ + +function ecount(num) +{ + + var section_txt= "

Counting from 1 to " + num + "

"; + var factor_of_3 = false; + var factor_of_5 = false; + + document.getElementById('output').innerHTML = section_txt; + + // count to N within the div + for(var i=1; i<=num; i++) + { + factor_of_3 = false; + factor_of_5 = false; + + + if((i % 3) === 0) + { factor_of_3 = true; + } + + if((i % 5) === 0) + { factor_of_5 = true; + } + + // factor of 3 only + if(factor_of_3 && !factor_of_5) + { document.getElementById('output').innerHTML += "
  • Fizz
  • "; + } + + + // factor of 5 only + else if(factor_of_5 && !factor_of_3) + { document.getElementById('output').innerHTML += "
  • Buzz
  • "; + } + + // factor of 3 and 5 + else if(factor_of_3 && factor_of_5) + { document.getElementById('output').innerHTML += "
  • FizzBuzz
  • "; + } + + + // not a factor of 3 or 5 + else + { document.getElementById('output').innerHTML += "
  • " + i + "
  • "; + } + + } + +} diff --git a/index.html b/index.html index 4ef4a89..ae4573b 100644 --- a/index.html +++ b/index.html @@ -19,6 +19,7 @@ + @@ -27,8 +28,10 @@

    Hello World!

    This is something!

    - + Enter a number: + +