<!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>
javascript怎么在html中使用
最新推荐文章于 2023-12-26 15:20:13 发布