Change Background Color

by KELO PROGRAMCI

HTML

<div id="square">
Ben Bir Kareyim. <br>Ve Bununla Gurur Duyuyorum!!!:D
Editör: KELOPROGRAMCI
</div>
<button id="button" >Renk Değiştir</button>
<text>Telif hakları saklıdır by keloprogramcı</text>

CSS

body{
	padding: 50px;
	}
#square{
	background-color: black;
	color: yellow;
	height: 130px;
	width: 170px;	
	padding-top: 15px;
	text-align:center;
	font-family: "Arial Black", sans-serif;
	margin-right:auto;
	margin-left: auto;
	}
button{
	width: 150px;
	padding: 10px;
	display: block;
	margin-right:auto;
	margin-left: auto;
	margin-top: 10px;
	}

JavaScript

//declare what's there 

var theBox = document.getElementById("square");
var myButton = document.getElementById("button");

//say the way

myButton.addEventListener('click', colorChange, false);

//run the fun

	function colorChange(){
	theBox.style.backgroundColor = "blue";
	
	}