js 创建一个浮动div的代码
发布时间:2024-04-10 14:02:55
标签:javascript,浮动div
<body> <script> //关闭DIV MENU function MenuClose() { var MenuDiv = document.getElementById("MenuDiv"); if(MenuDiv != null) { document.body.removeChild(MenuDiv); } } //创建menu function MenuPanel(opflag,operid, left, top) { var MenuDiv = document.getElementById("MenuDiv"); if(MenuDiv != null) { document.body.removeChild(MenuDiv); } var useflag = "停用帐号"; var flag=opflag; if (flag == "0") { useflag = "停用帐号"; } else { useflag = "激活帐号"; } MenuDiv = document.createElement("div"); MenuDiv.id = "MenuDiv"; MenuDiv.onmouseleave = function() { MenuClose(); } MenuDiv.style.position = "absolute"; MenuDiv.style.setAttribute("zIndex" ,"201"); MenuDiv.style.setAttribute("backgroundColor" ,"#EFEFEF"); MenuDiv.style.setAttribute("Font" ,"10pt"); MenuDiv.style.setAttribute("width" ,60); MenuDiv.style.setAttribute("left" ,left); MenuDiv.style.setAttribute("top" ,top); MenuDiv.innerHTML = "<table width=\"100%\">" +"<tr><td onclick=\"javascript:RedirectUrl(1,'" + flag + "','" + operid + "');MenuClose();\" style=\"cursor:hand;height:20px;Color:blue;\" onmouseover=\"this.style.backgroundColor='#FFD76B';\" onmouseout=\"this.style.backgroundColor='#EFEFEF';\" align=\"left\" valign=\"top\">"+useflag+"</td></tr>" +"<tr><td onclick=\"RedirectUrl(0,0,'" + operid + "')\" style=\"cursor:hand;height:20px;Color:blue;\" onmouseover=\"this.style.backgroundColor='#FFD76B';\" onmouseout=\"this.style.backgroundColor='#EFEFEF';\" align=\"left\" valign=\"top\">修改帐号</td></tr>" +"<tr><td onclick=\"javascript:RedirectUrl(4,0,'" + operid + "')\" style=\"cursor:hand;height:20px;Color:blue;\" onmouseover=\"this.style.backgroundColor='#FFD76B';\" onmouseout=\"this.style.backgroundColor='#EFEFEF';\" align=\"left\" valign=\"top\">重设密码</td></tr>" +"<tr><td onclick=\"RedirectUrl(2,0,'" + operid + "')\" style=\"cursor:hand;height:20px;Color:blue;\" onmouseover=\"this.style.backgroundColor='#FFD76B';\" onmouseout=\"this.style.backgroundColor='#EFEFEF';\" align=\"left\" valign=\"top\">角色管理</td></tr>" +"<tr><td onclick=\"javascript:RedirectUrl(3,0,'" + operid + "')\" style=\"cursor:hand;height:20px;Color:blue;\" onmouseover=\"this.style.backgroundColor='#FFD76B';\" onmouseout=\"this.style.backgroundColor='#EFEFEF';\" align=\"left\" valign=\"top\">删除帐号</td></tr>" +"</table>"; document.body.appendChild(MenuDiv); } //获取控件的高度和宽度 function getAbsolutePos(e) { var t=e.offsetTop; var l=e.offsetLeft; while(e=e.offsetParent) { t+=e.offsetTop; l+=e.offsetLeft; } var pos = { x: l, y: t }; return pos; } </script> <div id="jb51net" onclick="MenuPanel()">脚本之家代码测试(点击选择)</div> </body>
0
投稿
猜你喜欢
- 前言YOLOV5模型从发布到现在都是炙手可热的目标检测模型,被广泛运用于各大场景之中。因此,我们不光要知道如何进行yolov5模型的训练,而
- 1、数据驱动介绍:@ddt.ddt(类装饰器,申明当前类使用ddt框架)@ddt.data(函数装饰器,用于给测试用例传递数据),支持传py
- (1)标准类型操作符(所有的集合类型)成员关系 (in, not in) &nbs
- 使用Resample函数转换时间序列 一、什么是resample函数?它是Python数据分析库Pandas的方法函数。它主要用于
- 我们可以使用matplotlib.pyplot.locator_params()来控制刻度线 * 的行为。 即使通常会自动确定标记点的位置,
- 知道python有这几个内置方法,但一直以来用的都不多,最近重新看了一下,重新记录一下。map()会根据提供的函数对指定序列进行映射,pyt
- 遇到一个写文件的小程序,需要把print输出改成输出到文件,遇到这个问题的思路是把需要的字符串拼接到一个字符串中,然后在写到文件中,这样做觉
- 代码如下:<% '=================================================
- 简述在大多数此类教程中都会不遗余力的介绍如何使用数据库。今天我们对数据库暂且不表,而是来关注另一个在web应用中很重要的特性:如
- 很多时候我们都会有一个麻烦事,就是打开pycharm或者VScode等的时候,都有可能因为自己电脑上面安装的第三方模块过多,导致电脑很卡,风
- 在设计数据窗口时,在所有列的Background.Color属性中编写如下表达式: if ( IsRowNew(), 1090519039,
- 我用asp+access写程序, sql="select *&
- 函数就是把具有独立功能的代码块封装成一个小模块,可以直接调用,从而提高代码的编写效率以及重用性, 需要注意的是, 函数需要被调用才会执行,
- Microsoft SQL Server 2000复制的概念:在数据库之间对数据和数据库对象进行复制和分发并进行同步以确保其一致性的一组技术
- 异常是指因为程序出现了错误而在正常控制流以外采取的行动,其分为两个阶段,第一阶段是引发异常的错误,当系统检测到错误并且意识到异常条件,解释器
- 聚焦爬虫:爬取页面中指定的页面内容。编码流程:1.指定url2.发起请求3.获取响应数据4.数据解析5.持久化存储数据解析分类:1.bs42
- 最近在学习python网络编程这一块,在写简单的socket通信代码时,遇到了struct这个模块的使用,当时不太清楚这到底有和作用,后来查
- 问题详情:使用pip install pyecharts 安装的是最新版,本人默认回车后安装1.1.0版本,出现如图问题:解决方法:(推荐第
- 前言:1.前面基于Springboot的单体项目介绍已经完结了,至于项目中的其他功能实现我这里就不打算介绍了,因为涉及的知识点不难,而且都是
- 问题初始化数据库时mysqld --initialize --user mysql报错:mysqld: error while loadin