first commit

This commit is contained in:
编码猿
2024-09-27 02:06:13 +08:00
commit 852d94fbb9
36760 changed files with 3274413 additions and 0 deletions

View File

@@ -0,0 +1,55 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>留言字数限制</title>
<style>
body {
margin: 0;
padding: 0;
}
.main {
width: 400px;
height: 200px;
border: 1px solid #000;
position: relative;
}
.main span {
position: absolute;
right: 10px;
bottom: 10px;
}
textarea {
width: 100%;
height: 100%;
resize: none;
}
</style>
</head>
<body>
<div class="main">
<textarea name="" id="" cols="30" rows="10"></textarea>
<span>0/10</span>
</div>
</body>
<script>
var numberLength = 10;
var text = document.querySelector("textarea");
var span = document.querySelector("span");
text.oninput = function () {
if (numberLength - text.value.length > 0) {
var tipsText = `${text.value.length}/剩余${numberLength - text.value.length}`
span.innerText = tipsText;
} else {
text.value = text.value.substring(0,numberLength)
span.innerText = '超过字数限制';
}
}
</script>
</html>

View File

@@ -0,0 +1,73 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>社会主义核心价值观</title>
<style>
body,html{
margin: 0;
padding: 0;
width: 100%;
height: 100%;
}
span {
transition: all 1s cubic-bezier(1, 0.18, 0.46, 0.99) 0s;
position: fixed;
font-size: 20px;
user-select:none;
}
</style>
</head>
<body>
</body>
<script>
var body = document.querySelector("body"), i = -1;
body.onclick = function (e) {
var TextArray = ["富强","民主", "文明", "和谐","自由", "平等", "公正","法治", "爱国", "敬业","诚信", "友善"];
i++
if (i > TextArray.length-1) {
i = 0
}
var x = e.offsetX, y = e.offsetY, move = y - 30;
var span = document.createElement("span");
span.innerText = TextArray[i];
var colors = Math.round(Math.random()*360);
span.style.cssText = `
left: ${x}px;
top: ${move}px;
opacity: 1;
color: hsla(${colors},100%,50%,1);
`;
body.appendChild(span)
setTimeout(function(){
span.style.cssText = `
left: ${x}px;
top: ${move - 150}px;
opacity: 0;
color: hsla(${colors},100%,50%,1);
`;
}, 200)
setTimeout(function(){
body.removeChild(span)
}, 1300)
}
</script>
</html>