Skip to content

problem one completed #180

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
<title>Checkerboard</title>
</head>
<body>
<div>

</div>
<!-- NO EDITING THIS HTML FILE!!! STAY AWAY!!!! -->
<script type="text/javascript" src="script.js"></script>
</body>
</html>
</html>
37 changes: 36 additions & 1 deletion script.js
Original file line number Diff line number Diff line change
@@ -1 +1,36 @@
// Your JS goes here
//first, let's create a div container
//then let's create a div for red
//then let's create a div for black
//then let's style the red div
//then let's style the black div

var divContainer = document.createElement('div');
var divRed = document.createElement('div');
var divBlack = document.createElement('div');
// var body = document.getElementsbyTagName('body');


for(i=0;i<81;i++){
if(i % 2 === 0){
// divRed.innerHTML = divRed;
var divColor = document.createElement('div');
divColor.style.backgroundColor= 'red';
divColor.style.width = '11.1%'
divColor.style.paddingBottom = '11.1%';
divColor.style.float = 'left';
console.log(divRed);
//append your new red div to your container div
document.getElementsByTagName('body')[0].appendChild(divColor);
} else{
// divContainer.innerHTML = divBlack;
var divColor = document.createElement('div')
divColor.style.backgroundColor= 'black';
divColor.style.width = '11.1%'
divColor.style.paddingBottom = '11.1%';
divColor.style.float = 'left';
// console.log(divRed);
//append your new red div to your container div
document.getElementsByTagName('body')[0].appendChild(divColor);
}
divContainer.appendChild.divRed;
}