开/关开关x 2 - 适用于三种状态。 [英] On / Off Switch x 2 - for three states.

查看:68
本文介绍了开/关开关x 2 - 适用于三种状态。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个简单的div,其中包含一个已关闭的灯泡的平面.jpg图像,我需要在此div中添加2个开/关按钮,这样当用户点击第一个时,将会有一个.png伪造的白色发光(表示灯泡已打开),当他们点击第二个按钮时,红灯(再次,假的.png效果)将显示灯泡正在充电。



有人可以推荐一种方法来做这个或一个好的代码吗?



非常感谢!

I have a simple div which contains a flattened .jpg image of a lamp that is switched off, i need to add 2 "on/off" buttons to this div so that when the user clicks the first one there will be a .png of a faked white glow (indicating the lamp being turned on), and when they click the second button the red light (again, fake .png effect) will show the lamp being charged.

Can anyone recommend a way to do this or a good code?

Many thanks!

推荐答案

这是W3 Schools作为教程中第一个JavaScript示例之一的确切示例。



这里 [ ^ ]
That is an exact example of what W3 Schools gives as one of the first JavaScript examples in the tutorial.

Here[^]


这篇关于开/关开关x 2 - 适用于三种状态。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆