javascript怎么在html中使用

来源:互联网 发布:ubuntu kylin是什么 编辑:程序博客网 时间:2024/06/11 01:00
<!doctype html><html lang="en"><head>    <title>Webville Tunes</title>    <meta charset = "">    <script>    function init(){        var planet = document.getElementById("greenplanet");         planet.innerHTML = "Red Alert: hit by phaser fire";        var words1=["aaa", "bbb", "ccc"];        var rand1 = Math.floor(Math.random() * words1.length);        var phrase = words1[rand1];        var phraseElement = document.getElementById("phrase");        phraseElement.innerHTML = phrase;    }    window.onload = init;    </script></head><body><h1>Movie showtimes</h1><p id="greenplanet">All is well</p><p id = "phrase"></p></body></html>

原创粉丝点击