当前位置:网站首页>JS实现鼠标移入DIV随机变换颜色

JS实现鼠标移入DIV随机变换颜色

2020-12-01 15:16:54 程序猿欧文

今天分享一个在 JavaScript中,实现一个鼠标移入可以随机变换颜色,本质就是js的随机数运用。

代码如下:

<!DOCTYPE html><html>	<head>		<meta charset="utf-8">		<title></title>		<style>			/* 这里定义一下div(块元素)已下span 标签的宽.高.边框线以及边框线的颜色*/			span{				display: block;				width: 80px;				height: 80px;				border: 1px solid #000000;				float: left;			}		</style>	</head>	<body>		<div>			<span></span><span></span><span></span><span></span><span></span><span></span>			<span></span><span></span><span></span><span></span><span></span><span></span>			<span></span><span></span><span></span><span></span><span></span><span></span>			<span></span><span></span><span></span><span></span><span></span><span></span>			<span></span><span></span><span></span><span></span><span></span><span></span>			<span></span><span></span><span></span><span></span><span></span><span></span>			<span></span><span></span><span></span><span></span><span></span><span></span>			<span></span><span></span><span></span><span></span><span></span><span></span>			<span></span><span></span><span></span><span></span><span></span><span></span>			<span></span><span></span><span></span><span></span><span></span><span></span>			<span></span><span></span><span></span><span></sp.........

版权声明
本文为[程序猿欧文]所创,转载请带上原文链接,感谢
https://my.oschina.net/mikeowen/blog/4764986

随机推荐