当前位置: 动力学知识库 > 问答 > 编程问答 >

Beginner in JavaScript

问题描述:

< script type = "text/javascript" >

document.getElementById("alertme").onclick = function() {

alert("hell with you");

}

< /script>

#circle {

width: 500px;

height: 500px;

border-radius: 250px;

background-color: rgba(167, 10, 10, 0.595);

}

<!DOCTYPE html>

<html>

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>JavaScrip!</title>

</head>

<body>

<button id="alertme">Hello</button>

<p id="para1">

This is a test

</p>

<button id="alertp">Whats written</button>

<p id="inco">this is</p>

<button id="incomp">complete sentence</button>

<p id="change">i hate it</p>

<button id="changeMe">change it!</button>

<div id="circle">

</div>

<button id="hide">hide circle!</button>

</body>

</html>

<link rel="stylesheet" href="Styles.css" type="text/css">

网友答案:

your code is correct but u have not included the script in your code.

add your script in the head section or before closing the body

one more thing i want to point out is to place the style sheet in the header.

your working code onjsfiddle

分享给朋友:
您可能感兴趣的文章:
随机阅读: