php课程---JavaScript改变HTML中的元素

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script>
function myfunction()
{
  document.getElementById("demo").innerHTML = "亲爱的,我在听歌!";
}
</script>
</head>
<body>
<h1>My Wed Page</h1>
<p id="demo">你在干嘛?</p>
<button type="button" onclick="myfunction()">一定要点这里哟!</button>

</body>
</html>

 

posted @ 2016-02-21 08:51  秦萧不再  阅读(210)  评论(0编辑  收藏  举报