首页前端开发CSScss打字游戏源代码.txt

css打字游戏源代码.txt

时间2023-05-11 02:05:02发布访客分类CSS浏览1084
导读:body {font-family: Arial, sans-serif;font-size: 16px;line-height: 1.5;input[type="text"], select {display: block;width:...

body {

font-family: Arial, sans-serif;

font-size: 16px;

line-height: 1.5;

input[type="text"], select {

display: block;

width: 100%;

margin: 0 auto;

padding: 8px;

font-size: 16px;

border: 1px solid #ccc;

border-radius: 4px;

input[type="text"]:hover {

background-color: #e8e8e8;

CSS打字游戏

请输入名字:

请输入年龄:

请输入性别:

其他

请输入身高:

请输入体重:

请输入地址:

// 获取输入框和选择框

const nameInput=document.getElementById('name');

const ageInput=document.getElementById('age');

const genderInput=document.getElementById('gender');

const heightInput=document.getElementById('height');

const weightInput=document.getElementById('weight');

const addressInput=document.getElementById('address');

// 获取选中项的值

const gender=genderInput.value;

const height=heightInput.value;

const weight=weightInput.value;

const address=addressInput.value;

// 判断选中项是否为空

if (gender==='male' || gender==='female') {

// 打印选中项的性别

document.getElementById('gender').innerHTML=gender;

} else if (gender==='other') {

// 打印其他选项

document.getElementById('gender').innerHTML='其他';

} else {

// 打印默认性别

document.getElementById('gender').innerHTML='男';

// 获取输入框的值

const name=nameInput.value;

const age=ageInput.value;

const gender=genderInput.value;

const height=heightInput.value;

const weight=weightInput.value;

const address=addressInput.value;

// 开始打字

nameInput.addEventListener('submit', function() {

// 打印选中项的文本

document.getElementById('name').innerHTML=name;

addressInput.addEventListener('submit', function() {

// 打印输入框的文本

document.getElementById('address').innerHTML=address;

} );

} );

声明:本文内容由网友自发贡献,本站不承担相应法律责任。对本内容有异议或投诉,请联系2913721942#qq.com核实处理,我们将尽快回复您,谢谢合作!


若转载请注明出处: css打字游戏源代码.txt
本文地址: https://pptw.com/jishu/25899.html
灵活运用flex技术,打造极简风格的网页设计 为什么springboot推荐使用Thymeleaf

游客 回复需填写必要信息