Skip to content
Snippets Groups Projects
Commit fa74ca44 authored by asl337's avatar asl337
Browse files

Merge branch 'GenerateRandomColors' into 'main'

Update CI-ColorWebs/wwwroot/js/site.js, CI-ColorWebs/Pages/Index.cshtml,...

See merge request fds23/64/team-3/color-website!2
parents 89a80a6c 5f4bed97
No related branches found
No related tags found
No related merge requests found
@page
@page
@model IndexModel
@{
ViewData["Title"] = "Home page";
......@@ -7,4 +7,13 @@
<div class="text-center">
<h1 class="display-4">Welcome</h1>
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
<h2>
<button id="genNew">Generate New Random Color</button>
<span id="color"></span>
<span id="color2"></span>
<span id="color3"></span>
<span id="color4"></span>
<span id="color5"></span>
<span id="color6"></span>
</h2>
</div>
// Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
// Please see documentation at https://docs.microsoft.com/aspnet/core/client-side/bundling-and-minification
// for details on configuring this project to bundle and minify static web assets.
// Write your JavaScript code.
const cre = () => {
var ranColor = [];
for (var i = 0; i <= 5; i++){
const randomColor = Math.floor(Math.random()*16777215).toString(16);
ranColor.push(randomColor)
}
color.innerHTML = "#" + ranColor[0];
document.getElementById("color").style.color = "#" + ranColor[0];
color2.innerHTML = "#" + ranColor[1];
document.getElementById("color2").style.color = "#" + ranColor[1];
color3.innerHTML = "#" + ranColor[2];
document.getElementById("color3").style.color = "#" + ranColor[2];
color4.innerHTML = "#" + ranColor[3];
document.getElementById("color4").style.color = "#" + ranColor[3];
color5.innerHTML = "#" + ranColor[4];
document.getElementById("color5").style.color = "#" + ranColor[4];
color6.innerHTML = "#" + ranColor[5];
document.getElementById("color6").style.color = "#" + ranColor[5];
}
genNew.addEventListener("click", cre);
cre();
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment