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>


猜你喜欢
- 有 N 个花园,按从 1 到 N 标记。在每个花园中,你打算种下四种花之一。paths[i] = [x, y] 描述了花园 x 到花园 y
- 前言存储过程(Stored Procedure):一组可编程的函数,是为了完成特定功能的SQL语句集,经编译创建并保存在数据库中,用户可通过
- 项目中需要从Windows系统传输ISO文件到Linux测试系统,然后再Linux测试系统里安装这个ISO文件。所以就需要实现如何把文件从W
- 一、说明 关于matplotlib的scatter函数有许多活动参数,如果不专门注解,是
- 快到 520 了,分享几段 520 专属 Python 代码,不多说了,下面直接上货。No.1效果:主要代码:import tur
- 这两天在搞Theano,要把mat文件转成pickle格式载入Python。Matlab是把一维数组当做n*1的矩阵的,但Numpy里还是有
- 前言 使用scrapy进行大型爬取任务的时候(爬取耗时以天为单位),无论主机网速多好,爬完之后总会发现scrapy
- 点阵字体是指根据文字的像素点来显示的字体,效果如下:使用Python读取并显示的过程如下:根据中文字符获取GB2312编码通过GB2312编
- 我们知道,微信公众号开发分订阅号和服务号,而个人只能申请订阅号,订阅号不能设置菜单,无形中只能通过关键字回复实现,比如我回复帮助,就返回帮助
- remove()方法从列表中删除第一个obj。语法以下是remove()方法的语法:list.remove(obj)参数&nbs
- 本文实例为大家分享了wxPython绘图模块wxPyPlot实现数据可视化的具体代码,供大家参考,具体内容如下#-*- coding: ut
- update :单表的更新不用说了,两者一样,主要说说多表的更新 O
- 常见的绑定事件有直接绑定在页面元素中比如<div id="wrap" onclick="a();&quo
- 相信很多人在使用Ajax与后台php页面进行交互的时候都碰到过中文乱码的问题。JSON作为一种轻量级的数据交换格式,备受亲睐,但是用PHP作
- 简介pandas中的DF数据类型可以像数据库表格一样进行groupby操作。通常来说groupby操作可以分为三部分:分割数据,应用变换和和
- 本文实例讲述了Django框架HttpResponse对象用法。分享给大家供大家参考,具体如下:1.HttpResponse可通过HttpR
- python查找图片按钮的坐标位置因为业务需求,了解到一些python自动化的内容,其中有类似于airtest截图点击的东西。本来是想使用p
- 利用js实现点击一张图片,直接上传到指定的action,方法简单,一看就会了,只需要用户点击图片一次就可以实现图片上传功能。主要用到了onc
- 比如我随便从手机上传一张图片到我的电脑里,通过python可以获取这张照片的所有信息。如果是数码相机拍摄的照片,我们在属性里可以找到照片拍摄
- 前言最近在学习python,对于python的print一直很恼火,老是不按照预期输出。在python2中print是一种输出语句,和if语