diff --git a/flashing.js b/flashing.js new file mode 100644 index 00000000..5ca8de28 --- /dev/null +++ b/flashing.js @@ -0,0 +1,30 @@ + + + +var flashing = document.getElementsByTagName('div') + + +function getRandomColor() { + var letters = '0123456789ABCDEF'.split(''); + var color = '#'; + for (var i = 0; i < 6; i++ ) { + color += letters[Math.floor(Math.random() * 16)]; + } + return color + } + +setInterval(function(){ + for (var i = 0; i < flashing.length; i++) { + flashing[i].style.backgroundColor = getRandomColor(); + } + }, 100); + + +for (var i = 0; i < 72; i++){ + var div = document.createElement('div'); + div.style.backgroundColor = getRandomColor(); + div.style.width = '11.1%' + div.style.float = 'left' + div.style.paddingBottom = '11.1%' + body.appendChild(div); +} diff --git a/index.html b/index.html index 5e82cbe3..5fd3f580 100644 --- a/index.html +++ b/index.html @@ -6,5 +6,9 @@ + + - \ No newline at end of file + diff --git a/randomcolors.js b/randomcolors.js new file mode 100644 index 00000000..94b70514 --- /dev/null +++ b/randomcolors.js @@ -0,0 +1,20 @@ +// +// +// +// +// for (var i = 0; i < 63; i++){ +// var div = document.createElement('div'); +// div.style.backgroundColor = getRandomColor(); +// div.style.width = '11.1%' +// div.style.float = 'left' +// div.style.paddingBottom = '11.1%' +// body.appendChild(div); +// } +// function getRandomColor() { +// var letters = '0123456789ABCDEF'.split(''); +// var color = '#'; +// for (var i = 0; i < 6; i++ ) { +// color += letters[Math.floor(Math.random() * 16)]; +// } +// return color; +// } diff --git a/script.js b/script.js index 9233771b..6fa9dad0 100644 --- a/script.js +++ b/script.js @@ -1 +1,25 @@ -// Your JS goes here \ No newline at end of file +var body = document.getElementsByTagName('body')[0] + +for (var i = 0; i < 40; i++) { + +var div = document.createElement("div1") + div.style.backgroundColor = "black"; + div.style.paddingBottom = "11.1%"; + div.style.width = "11.1%"; + div.style.float = "left"; + body.appendChild(div) + +var div = document.createElement("div2") + div.style.backgroundColor = "red"; + div.style.paddingBottom = "11.1%"; + div.style.width = "11.1%"; + div.style.float = "left"; + body.appendChild(div) + +} +var div = document.createElement("div3") + div.style.backgroundColor = "black"; + div.style.paddingBottom = "11.1%"; + div.style.width = "11.1%"; + div.style.float = "left"; + body.appendChild(div)