JavaScrip——练习(做悬浮框再进一步:悬浮窗后缀悬浮窗——用this.className)

对悬浮窗进一步改进:

用this.className

可以省略script

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<style type="text/css">
*{
    margin:0px;
    padding:0px;
    }
.aa
{
    background-color:#FF0;

    height: 40px;
    width: 100px;
    top: 60px;
    left: 100px;
    position: absolute;
    overflow: hidden;
    text-align: center;
    line-height:40px;
    }
    .aaa
{
    background-color:red;

    height: 40px;
    width: 100px;
    top: 60px;
    left: 100px;
    position: absolute;
    overflow:visible;
    text-align: center;
    line-height:40px;
    }
#bb{

    height:120px;
    width:100px;
    top:40px;
    left:0px;
    position:absolute;

    }
table{

    height:120px;
    width:100px;
    text-align:center;
    vertical-align:middle;
}
.tiyu
{
    height:40px;
    width:100px;
    position:absolute;
    overflow:hidden;
    left:0px;
    top:0px;
    }
.zuqiu
{
    height:40px;
    width:100px;
    position:absolute;
    overflow:visible;
    left:0px;
    top:0px;
    }
#zuqiu
{
    height:40px;
    width:100px;
    position:absolute;
    left:100px;
    top:0px;
    background-color:#C63;
    }
.yule
{
    height:40px;
    width:100px;
    position:absolute;
    overflow:hidden;
    left:0px;
    top:40px;
    }
    .bagua
{
    height:40px;
    width:100px;
    position:absolute;
    overflow:visible;
    left:0px;
    top:40px;
    }
#bagua
{
    height:40px;
    width:100px;
    position:absolute;
    left:100px;
    top:0px;
    background-color:#C63;
    }
.guoji
{
    height:40px;
    width:100px;
    position:absolute;
    overflow:hidden;
    left:0px;
    top:80px;
    }
.junshi
{
    height:40px;
    width:100px;
    position:absolute;
    overflow:visible;
    left:0px;
    top:80px;
    }
#junshi
{
    height:40px;
    width:100px;
    position:absolute;
    left:100px;
    top:0px;
    background-color:#C63;
    }
</style>
</head>

<body>
<div class="aa" onmousemove="this.className=‘aaa‘" onmouseout="this.className=‘aa‘">新闻动态
<div id="bb">
<table cellpadding="0" cellspacing="0">

<tr bgcolor="#0000FF">

<td height="40" width="100">
<div class="tiyu" onmouseover="this.className=‘zuqiu‘" onmouseout="this.className=‘tiyu‘">体育
<div id="zuqiu">足球</div></div></td>

</tr>

<tr bgcolor="#FFFF00">
<td height="40" width="100">
<div class="yule" onmousemove="this.className=‘bagua‘" onmouseout="this.className=‘yule‘">娱乐
<div id="bagua">八卦</div></div></td>

</tr>

<tr bgcolor="#00FFFF">
<td height="40" width="100">
<div class="guoji" onmouseover="this.className=‘junshi‘" onmouseout="this.className=‘guoji‘">国际新闻
<div id="junshi">军事</div></div></td>
</tr>
</table>

</div></div>

</body>
</html>

结果是一样的:

默认时

鼠标在新闻动态上面时

鼠标在体育上面时:

鼠标在娱乐上面时:

鼠标在国际新闻上面时:

时间: 2024-08-02 00:24:18

JavaScrip——练习(做悬浮框再进一步:悬浮窗后缀悬浮窗——用this.className)的相关文章

使用悬浮框监听内存的使用状态 -- 附源码

源码下载地址:http://download.csdn.net/detail/hewence1/8176601 <span style="font-family: Arial, Helvetica, sans-serif; background-color: rgb(255, 255, 255);">先看一下效果:  显示当前内存使用率55% ,每一秒都刷新一次</span> 实现原理,在Service中创建一个悬浮框就可,在service中每秒钟访问计算一次单

Echarts ecomfe 触摸屏 touch 在IE10下无法显示悬浮框

问题描述: Windows 8 IE10浏览http://echarts.baidu.com/doc/example/line2.html 时,鼠标放置在数据点上时无法显示悬浮框. 正常情况为: 而现在情况为: ? 问题分析: 公司有各种型号电脑,X230,W530,X240,业务部门多使用x240, 这一款笔记本屏幕带有触摸屏功能,其他型号没有.所有操作系统都为win8,IE10小版本号也一致. 最初就将问题定位为触摸屏引起了这个问题,但一直无法找到具体原因.因为在chrome,firfox等

(40)JS运动之右下角悬浮框

<!DOCTYPE HTML> <!-- --> <html> <head> <meta charset="utf-8"> <title></title> <style> #div1{ width:100px; height:150px; background:red; position:absolute; right:0; bottom:0; } </style> <s

(41)JS运动之右侧中间悬浮框(对联悬浮框)

<!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title></title> <style> #div1{ width:100px; height:150px; background:red; position:absolute; right:0; bottom:0; } </style> <script> windo

mouseleave mouseout时候悬浮框不应该消失的时候消失了 css 解决办法

要实现的效果和代码思路 简单来说就是 用一个div包着喇叭和悬浮框 悬浮事件写在这个div上 鼠标悬浮到div上的时候 悬浮框出现 最终要做成鼠标从小喇叭移动到下面的框上的时候 下面框是不会消失的. 遇到的问题 遇到的问题是 当鼠标从喇叭移动到悬浮框上面的时候 鼠标移动到三角那个空隙的时候 下面的悬浮框就会消失 解决办法有的人说 mouseleave的时候用timeout判断一下,如果移到下面那个悬浮框上了(判断是否移动到悬浮框,给悬浮框写mouseentered事件),就把隐藏逻辑停掉就行了,

Android 悬浮窗、悬浮球开发

原文:Android 悬浮窗.悬浮球开发 1.权限管理 直接看我另外一篇博客吧,传送门: https://my.oschina.net/u/1462828/blog/1933162 2.Base类BaseSuspend import android.content.Context; import android.graphics.PixelFormat; import android.os.Build; import android.view.Gravity; import android.vi

移动端悬浮框可移动,可回弹,Vue and React

一,首先讲 React的悬浮框 示例,可参照链接 Demo文档,可参照链接 1. 安装 npm install suspend-button -S 2. 使用 import React, { Component } from 'react' import ReactDOM from 'react-dom' import SuspendButton from 'suspend-button' class App extends Component { render() { return ( <Su

小米Adnroid默认禁止悬浮框的使用,导致开发的悬浮框无法接收事件

比如你建了一个悬浮框: WindowManager windowManager = getWindowManager(context); int screenWidth = windowManager.getDefaultDisplay().getWidth(); if (smallWindow == null) { smallWindow = new FloatWindowSmallView(context); if (smallWindowParams == null) { smallWin

js实现页面悬浮框

当滚动条下拉时,悬浮框位置不变,主要是 position:fixed;样式的作用. 当下拉到一定程度,接近footer时,我用js控制div消失,往上拉滚动条时又显示. <!DOCTYPE html> <html> <head> <title></title> <style type="text/css"> .div1 { height:2000px; } .div2 { width:100%; height:35