html网页上按钮交替切换bottom shift代码
来源:互联网 发布:centos破解wifi密码 编辑:程序博客网 时间:2024/06/18 11:33
以下代码实现了在网页上显示一个按钮,点击按钮时,“开灯”、“关灯”交替显示,
好处:这样的写法方便在不同的按钮下加上不同的的响应程序,如下在my_light_on_function()和my_light_off_function()中分别加入不同的程序即可。
<head>
<script type="text/javascript">
function my_light_on_function(){
}
function my_light_off_function(){
}
</script>
/*开关按钮都设置成一样的样式,包括位置和形状大小等,体现一致性*/
<style>
/*开灯按钮*/
.light_on {
width: 100px;
height: 70px;
font-size:20px;
position:absolute;
top:20px;
left:450px;
}
/*关灯按钮*/
.light_off {
width: 100px;
height: 70px;
font-size:20px;
position:absolute;
top:20px;
left:450px;
}
</style>
<body>
<input class="light_off" type="submit" id="light_off" onclick=
"document.getElementById('light_on').style.display='inline';document.getElementById('light_off').style.display='none';my_light_off_function();show()" value="关灯"/>
<input class="light_on" type="submit" id="light_on" onclick=
"document.getElementById('light_on').style.display='none';document.getElementById('light_off').style.display='inline';my_light_on_function();show()" value="开灯"/>
</body>
本程序可直接拷贝并测试效果。
- html网页上按钮交替切换bottom shift代码
- 网页一键分享按钮HTML代码
- 网页一键分享按钮HTML代码
- 在网页上显示html代码
- html+css:按钮上显示消息数量精简代码
- 网页图片切换代码
- html5的网页在MAC及ipad上按钮无法正常切换的处理
- 在网页上显示所在地天气预报的html代码
- 在HTML网页上打印需要的内容,JS代码
- 网页html随机切换背景图片
- 精简按钮样式切换代码
- 阻止用户在网页上点击特殊按键Ctrl, Shift...
- 网页上切换图片效果
- HTML网页代码大全
- 北京时间网页html代码
- html网页详细代码
- html 网页代码
- 网页实战技巧--按钮背景切换
- HDU Bomb(数位DP)
- leetcode 242. Valid Anagram
- ios 项目中的全局、局部、成员、属性变量
- 动态添加DataTemplate且为模板中的button控件添加Click Event
- ajax请求学习
- html网页上按钮交替切换bottom shift代码
- 操作系统中进程调度策略有哪几种
- iOS搭建CI持续集成环境
- Java Calendar 类的时间操作
- git .gitignore 忽略不需要被提交的文件
- [BZOJ 4320]ShangHai2006 Homework
- Android开发者入门必知了解谷歌官方Android开发文档
- 解决scrollView中嵌套编辑框导致不能上下滑动的问题
- 银联支付