GetRekt
How do I make an getrekt?
What is a getrekt? How do you make a getrekt? This script and codes were developed by Anthony Keithley on 24 December 2022, Saturday.
GetRekt - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>getRekt</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <h1>Rectangle Maker</h1>
<h2>Enter the desired width and height</h2>
<p>Width:<input type="number" id="w" min="1" ></p>
<p>Height:<input type="number" id="h" min="1" ></p>
<button onclick="getRekt()">GO!</button>
<button onclick="random()">Random Size</button>
<p>Perimeter: <span id="p">400px</span> Area: <span id="a">10000px<sup>2</sup></span></p>
<div id="rectangle"></div> <script src="js/index.js"></script>
</body>
</html>
GetRekt - Script Codes CSS Codes
body { text-align: center;
}
#rectangle { width: 100px; height: 100px; background: blue; margin:0 auto;
}
GetRekt - Script Codes JS Codes
function getRekt(){ //Get the numbers from the input fields var rektWidth = 100; var rektHeight = 100; rektWidth = document.getElementById("w").value; rektHeight = document.getElementById("h").value; //The div that makes the rectangle var rekt = document.getElementById("rectangle"); //Sets the width and height properties to the //inputs if(rektWidth > 0){ rekt.style.width = rektWidth + "px"; rekt.style.height = rektHeight + "px"; } else { rekt.style.width = "0px"; rekt.style.height = "0px"; } //Chooses random values for red, green, blue var randoR = Math.floor(Math.random() * 255); var randoG = Math.floor(Math.random() * 255); var randoB = Math.floor(Math.random() * 255); //Changes to random background color rekt.style.background = "rgb(" + randoR + ", " + randoG + "," + randoB + ")"; //Calculate and set the perimeter and area calcPandA(rektWidth, rektHeight);
}
function random(){ //Get the numbers from the input fields var rektWidth = Math.floor(Math.random() * 990) + 10; var rektHeight = Math.floor(Math.random() * 990) + 10; //The div that makes the rectangle var rekt = document.getElementById("rectangle"); //Sets the width and height properties to the //inputs rekt.style.width = rektWidth + "px"; rekt.style.height = rektHeight + "px"; //Chooses random values for red, green, blue var randoR = Math.floor(Math.random() * 255); var randoG = Math.floor(Math.random() * 255); var randoB = Math.floor(Math.random() * 255); //Changes to random background color rekt.style.background = "rgb(" + randoR + ", " + randoG + "," + randoB + ")"; calcPandA(rektWidth, rektHeight);
}
function calcPandA(w,h){ //Calculate and set the perimeter and area document.getElementById("p").innerHTML = 2 * w + 2 * h + "px"; document.getElementById("a").innerHTML = w * h + "px<sup>2</sup>";
}
Developer | Anthony Keithley |
Username | KeithleySLHS |
Uploaded | December 24, 2022 |
Rating | 3 |
Size | 2,206 Kb |
Views | 8,096 |
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!
Name | Size |
5-2-17 | 1,685 Kb |
Nav Bar | 1,597 Kb |
CSS3 | 1,849 Kb |
SystemsSolver | 1,948 Kb |
Input and Output Test | 1,714 Kb |
MuchoMatho | 2,219 Kb |
Age Calculator | 1,488 Kb |
Keyframes May 4 | 1,657 Kb |
Animations Practice | 1,613 Kb |
CSS Borders | 1,433 Kb |
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!
Name | Username | Size |
Donald Trump - The New Yorker | Agbales | 2,502 Kb |
Wikipedia viewer | Chpecson | 2,865 Kb |
A Pen by Anoop | Anoopjohn | 330,760 Kb |
CSS Parent Selector | Tomhodgins | 2,143 Kb |
Em Test | Rodesco | 1,784 Kb |
Lazy Load for Background Images | The_ruther4d | 2,977 Kb |
A Pen by Xand0r | Xand0r | 1,928 Kb |
Carousel Test | Sbirchall | 1,509 Kb |
SlideDown FixedMenu | Mp_graphic | 5,602 Kb |
A Pen by Mohomed Anees | Mohomedanees | 12,597 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!