<body> 中的 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" />
</head>
<body>
<div class="container"style="padding:50px">
<h3>&lt;body&gt;中的 JavaScript函数</h3>
<hr />
<p id="pid">点击按钮改变DOM元素的内容</p>
<br />
<button id="demo" class="btn btn-primary"onclick="myFunction()">尝试一下</button>
<script>
//function myFunction() {
// document.getElementById("pid").innerHTML = "Hello,JavaScript";
//}
$(document).ready(function () {
$("#demo").click(function () {
document.getElementById("pid").innerHTML = "Hello,JavaScript";
})
})
</script>
</div>
</body>
</html>

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