Home > Web Front-end > JS Tutorial > js code to create a floating div_javascript skills

js code to create a floating div_javascript skills

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 18:38:04
Original
1393 people have browsed it

[Ctrl A select all Note: If you need to introduce external Js, you need to refresh to execute
]<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+"" +"<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\">修改帐号" +"<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\">重设密码" +"<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\">角色管理" +"<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\">删除帐号" +""; 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>
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
What are JavaScript hook functions?
From 1970-01-01 08:00:00
0
0
0
What is JavaScript garbage collection?
From 1970-01-01 08:00:00
0
0
0
c++ calls javascript
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template