1页面刷新时默认显示一种主题
2用户点击主题更换按钮,显示主题选择页面
3用户打开主题选择页面后,若选中主题背景后点击确定,则将主题背景更换,并隐藏主题选择面板
4用户打开选择界面后,若选点击取消,则不可对主题背景做任何修改,并隐藏主题选择面板
2用户点击主题更换按钮,显示主题选择页面
3用户打开主题选择页面后,若选中主题背景后点击确定,则将主题背景更换,并隐藏主题选择面板
4用户打开选择界面后,若选点击取消,则不可对主题背景做任何修改,并隐藏主题选择面板
解决方案 »
- 在线等大神解答哈,请问如何下载rtmpt协议开头的视频哈?在线等大神,人气积分伺候着呢哈!!!
- 如何用实现Javascript实现在GridView上的check全选
- firefox ie用jquery的load()方法加载xml(已绑定xsl)
- 一个入门的问题,需要帮助~~~~~谢谢
- 用IE内置组件打印,如何控制页眉,页脚的格式
- 能用javascript在页面上创建新层吗?
- 一个复选框的问题
- 众位朋友谁有全点的VML的编程资料?我有急用!!!
- 关于框架的很菜的问题!!
- 怎样实现两个下拉框不同时有效?
- mui 的alert弹框确认后 跳转指定页面的问题 望大神指导
- 前端,每天准点更新数组里面的数据?
<body>
<div onclick="Theme()">主题</div>
<div class="theme-list" id="themes">
<form name="themeForm">
<input type="radio" name="theme" value="red">red</input><br><br>
<input type="radio" name="theme" value="yellow">yellow</input><br><br>
<input type="radio" name="theme" value="green">green</input><br><br>
<input type="radio" name="theme" value="">none</input><br><br>
<input type="button" value="确定" onclick="setTheme()">
<input type="button" value="取消" onclick="Theme()">
</form>
</div>
</body>
<style>
.theme-list {
display: none;
}
</style>
<script>
let themeEl = document.getElementById('themes')
let themeV = document.themeForm.theme
if (localStorage.theme) {
themeV.value = localStorage.theme
setTheme('init')
}
function Theme () {
if (themeEl.style.display == 'none' || !themeEl.style.display) {
themeEl.style.display = 'block'
} else {
themeEl.style.display = 'none'
}
}
function setTheme (type) {
document.body.style.background = themeV.value
localStorage.theme = themeV.value
if (!type) {
Theme()
}
}
</script>背景要换图片可以改radio的value 用class名然后样式里面用background配置背景图