javascript 单击按钮出现文本内容

来源:互联网 发布:海拔高度查询软件 编辑:程序博客网 时间:2024/05/29 09:21
<!doctype html><html>     <head>        <meta charset="utf-8">        <title>单击按钮出现文本内容</title>                <script>            function myfunction()  {  var x="Have fun!"document.getElementById("demo").innerHTML=x;   }        </script>     </head>     <body>          <button onclick="myfunction()">点击这里</button>          <p id="demo"></p>     </body></html>


效果如下:


原创粉丝点击