Posted in Javascript onOctober 15, 2019
本文实例为大家分享了javascript实现点亮灯泡特效的具体代码,供大家参考,具体内容如下
<!doctype html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <meta name='description' content='本文来源于Apollo个人整理,仅供参考!'> <title>点亮灯泡</title> <style type="text/css"> div{ width: 500px; height: 400px; background-color:lightgoldenrodyellow; } </style> </head> <body> <div> <img id="demo" src="./pic_bulboff.gif" alt="灯泡"> </div> <script> document.getElementById('demo').onclick = function () { ele = document.getElementById('demo'); if (ele.src.match('bulbon')){ ele.src = './pic_bulboff.gif'; }else{ ele.src = './pic_bulbon.gif'; } } </script> </body> </html>
图片pic_bulboff.gif
图片pic_bulbon.gif
以上就是本文的全部内容,希望对大家的学习有所帮助,也希望大家多多支持三水点靠木。
javascript实现点亮灯泡特效示例
- Author -
Apollo声明:登载此文出于传递更多信息之目的,并不意味着赞同其观点或证实其描述。
Reply on: @reply_date@
@reply_contents@