CMT3 - Opdracht4

Size
2,035 Kb
Views
8,096

How do I make an cmt3 - opdracht4?

What is a cmt3 - opdracht4? How do you make a cmt3 - opdracht4? This script and codes were developed by Karlien Huygels on 29 October 2022, Saturday.

CMT3 - Opdracht4 Previews

CMT3 - Opdracht4 - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>CMT3 - Opdracht4</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <body> <div></div>	<div></div>	<div></div>	<div></div>	<div></div>	<div></div>	<div></div>	<div></div>	<div></div>	<p></p>
</body> <script src="js/index.js"></script>
</body>
</html>

CMT3 - Opdracht4 - Script Codes CSS Codes

div { box-sizing: border-box; border: 1px solid black; width: 100px; height: 100px; float: left; margin-right: 10px; margin-bottom: 10px;}
div:nth-child(3), div:nth-child(6), div:nth-child(9) { margin-right: 0;
}
body { width: 320px; margin: 50px auto;}
.rood { background-color: red;}
p { display: inline; font-family: "helvetica neue"; color: darkgrey;}

CMT3 - Opdracht4 - Script Codes JS Codes

function main() { var vakjes = document.getElementsByTagName("div"); var aantal = document.getElementsByTagName("p")[0]; var teller = 1; var teller2 = 0; var i =0; vakjes[0].className = "rood"; aantal.innerHTML = teller; while(i < vakjes.length){ vakjes[i].onclick = function(){ if(this.className === "rood"){ if(teller < 9){ if(teller === 1){ vakjes[1].className = "rood"; vakjes[2].className = "rood"; teller = 3; } else if(teller === 3){ vakjes[3].className = "rood"; vakjes[4].className = "rood"; teller = 5; } else if(teller === 5){ vakjes[5].className = "rood"; vakjes[6].className = "rood"; teller = 7; } else if(teller === 7){ vakjes[7].className = "rood"; vakjes[8].className = "rood"; teller = 9; } } else if(teller === 9){ while(teller2 < vakjes.length){ vakjes[teller2].className = ""; teller2++; } teller2 = 0; teller = 1; vakjes[0].className ="rood"; } } aantal.innerHTML = teller; } i++; }
}
window.onload = function (){ main();
}
CMT3 - Opdracht4 - Script Codes
CMT3 - Opdracht4 - Script Codes
Home Page Home
Developer Karlien Huygels
Username KarlienHuygels
Uploaded October 29, 2022
Rating 3
Size 2,035 Kb
Views 8,096
Do you need developer help for CMT3 - Opdracht4?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Karlien Huygels (KarlienHuygels) Script Codes
Create amazing Facebook ads with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!