案例
有一块空白区域, 当鼠标移动到区域内,显示"亲爱的, 我爱你", 当我鼠标移开的时候,显示"对不起, 开玩笑", 当我鼠标不停的在区域内移动的时候, 变换随机颜色(随机十六进制的颜色:#FFFFFF)
在写js之前先将html以及css内容写好,在这基础上进行js操作


由于题目需求一个白色的区域块。所以html以及css样式比较简单
接下来进行js操作

其中通过.innerHTML将box内容改变
再通过onmouseenter鼠标移入以及onmouseleave鼠标移出完成以上图片的功能

网友评论