Files
ClassContent/历届学生/韩一伟/项目开发/练习项目/作业/2021.07.09/index.html
2024-09-27 02:06:13 +08:00

64 lines
1.2 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
body {
margin: 0;
height: 100vh;
position: relative;
overflow: hidden;
}
.text {
position: absolute;
}
</style>
</head>
<body>
</body>
<script>
// var height = document.body.clientHeight,
// width = document.body.clientWidth
function CreatedAiGuo() {
var text = ["富强", "民主", "文明", "和谐", "自由", "平等", "公正" ,"法治", "爱国", "敬业", "诚信", "友善"]
var span = document.createElement("span")
span.innerText = text[index];
var x=parseInt(Math.random()*width)
var y=parseInt(Math.random()*height)
span.className="span"
span.style.left=`${x}px`
span.style.top=`${y}px`
$("body").appendChild(span)
}
setInterval(function () {
CreatedAiGuo()
}, 1000);
function $(className) {
return document.querySelector(className)
}
</script>
</html>