html button 按钮单选且 高亮

<DIV class="middle">

<div class="containerTarget">

<span class="hover-target1" οnclick="btn(1);">韵达 </span>

<span class="hover-target2" οnclick="btn(2);">中通 </span>

<span class="hover-target3" οnclick="btn(3);">圆通 </span>

</div>

</DIV>

function go_savebtn(e) {

if (e == '1') {

if (document.querySelector(".hover-target1")) {

document.querySelector(".hover-target1").className = 'hover-static1'

}

else {

document.querySelector(".hover-static1").className = 'hover-target1'

}

} else if (e == '2') {

if (document.querySelector(".hover-target2")) {

document.querySelector(".hover-target2").className = 'hover-static2'

}

else {

document.querySelector(".hover-static2").className = 'hover-target2

}

} else if (e == '3') {

if (document.querySelector(".hover-target3")) {

document.querySelector(".hover-target3").className = 'hover-static3'

} else {

document.querySelector(".hover-static3").className = 'hover-target3'

}

}

}

.hover-target1,

.hover-target2,

.hover-target3 {

cursor: pointer;

background-color: #fff(64, 158, 255, 1);

color: #000;

}

.hover-static1,

.hover-static2,

.hover-static3 {

cursor: pointer;

background-color: rgba(64, 158, 255, 1);

color: white;

}

.hover-target1:hover,

.hover-target2:hover,

.hover-target3:hover {

cursor: pointer;

background-color: rgba(64, 158, 255, 1);

color: white;

border-radius: 5px;

border: 1px solid #ccc;

width: 136px;

height: 40px;

}

相关推荐
RobinDevNotes1 小时前
从 Electron 到 GPUI,9 个跨平台桌面方案该怎么选
前端·javascript·rust·electron·openresty·前端开发工具
程序员大阳1 小时前
HTML+CSS+JS对话式实战(6)-学生端查看活动功能开发
javascript·css·html·模块·查看学生
jay神2 小时前
基于 YOLOv8 的轴承缺陷检测(Web 版)
前端·人工智能·yolo
jay神2 小时前
基于 YOLOv8 的森林火灾检测系统(Web 版)
前端·yolo
code2cat2 小时前
HTML基础篇之第一张网页:从index.html到浏览器里的任务清单
前端·html
miss3 小时前
AI 改完不敢上线?OpenSpec 规约驱动开发实战
前端·代码规范·前端工程化
AiMan3 小时前
腾讯ima还是不可以导出左侧所有对话,只能单条导出,方法不对吗
前端
去伪存真3 小时前
并发量一高就装死?Agent 全链路“防猝死”手册
前端·agent
Moment3 小时前
AI 编程时代,聊聊我的 Mac mini 双屏桌面
前端·后端
AiMan4 小时前
先确认能不能一次把Microsofat Copilot所有内容打包一个文件导出
前端