<!DOCTYPE html>
<html>
<body>

<h1>最帅的人是谁?</h1>

<p id="demo">
你想知道么?
</p>

<script>
function myFunction()
{
x=document.getElementById("demo");  // 找到元素
x.innerHTML="你最帅了!美丽的老公大帅哥!哈哈哈,来,亲一个!";    // 改变内容
}
</script>

<button type="button" onclick="myFunction()">点击这里</button>

</body>
</html>

 

 

 

很简单的一个原理

 

javascript可以改变HTML5中的内容

posted on 2015-02-04 09:43  怦顔  阅读(600)  评论(5编辑  收藏  举报