<head> 中的 JavaScript 函数

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<meta charset="utf-8" />
<script src="jQuery/jquery-2.2.0.min.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
<link rel="stylesheet"href="bootstrap/css/bootstrap.min.css" />
<script>
//function myFunction() {
// document.getElementById("demo").style.backgroundColor ="red"
//}
$(document).ready(function () {
$("#demo").click(function () {
document.getElementById("demo").style.backgroundColor = "red";
})
})
</script>
</head>
<body>
<div class="container"style="padding:50px">
<h3>&lt;head&gt;中的 JavaScript</h3>
<hr />
<div onclick="myFunction()" id="demo">点击改变div元素的背景颜色</div>
</div>
</body>
</html>

posted @ 2016-01-16 16:24  melao2006  阅读(245)  评论(0编辑  收藏  举报