Professional Documents
Culture Documents
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Javascript</title>
<style type="text/css">
body{
font-family: sans-serif;
#shape{
width: 200px;
height: 200px;
display: none;
background-color: orange;
position: relative;
.bold{
font-weight: bold;
</style>
</head>
<body>
<div id="shape"></div>
<script type="text/javascript">
function getRandomColor(){
color+= letters[Math.floor(Math.random()*16)];
return color;
function makeshapeappear(){
if (Math.random() >0.5){
document.getElementById("shape").style.borderRadius = "50%";
} else{
document.getElementById("shape").style.borderRadius = "0";
document.getElementById("shape").style.backgroundcolor = getRandomColor();
document.getElementById("shape").style.display = "block"
function appearAfterDelay(){
setTimeout(makeshapeappear, Math.random()*2000);
appearAfterDelay();
document.getElementById("shape").onclick = function(){
document.getElementById("shape").style.display = "none";
appearAfterDelay();
}
</script>
</body>
</html>