资料
表格
制度
合同
管理
职场
经营
创业
范文
总结
计划
作文
文章
美文
词句
教程
模板
图片
字体
图标
办公
人事
财务
生产
管理资源吧首页
>>>
教程
>>>
编程
>>>
JavaScript教程
>>>
js 创建一个浮动div的代码
<body> <img src="/_New/_cj/myeditor/sysimage/space.gif" class="ewebeditor__script" _ewebeditor_fake_tag="script" _ewebeditor_fake_value="%3Cscript%3E%20%0D%0A%2F%2F%E5%85%B3%E9%97%ADDIV%20MENU%20%0D%0Afunction%20MenuClose()%20%0D%0A%7B%20%0D%0Avar%20MenuDiv%20%3D%20document.getElementById(%22MenuDiv%22)%3B%20%0D%0Aif(MenuDiv%20!%3D%20null)%20%0D%0A%7B%20%0D%0Adocument.body.removeChild(MenuDiv)%3B%20%0D%0A%7D%20%0D%0A%7D%20%0D%0A%2F%2F%E5%88%9B%E5%BB%BAmenu%20%0D%0Afunction%20MenuPanel(opflag%2Coperid%2C%20left%2C%20top)%20%0D%0A%7B%20%0D%0Avar%20MenuDiv%20%3D%20document.getElementById(%22MenuDiv%22)%3B%20%0D%0Aif(MenuDiv%20!%3D%20null)%20%0D%0A%7B%20%0D%0Adocument.body.removeChild(MenuDiv)%3B%20%0D%0A%7D%20%0D%0A%0D%0Avar%20useflag%20%3D%20%22%E5%81%9C%E7%94%A8%E5%B8%90%E5%8F%B7%22%3B%20%0D%0Avar%20flag%3Dopflag%3B%20%0D%0Aif%20(flag%20%3D%3D%20%220%22)%20%0D%0A%7B%20%0D%0Auseflag%20%3D%20%22%E5%81%9C%E7%94%A8%E5%B8%90%E5%8F%B7%22%3B%20%0D%0A%7D%20%0D%0Aelse%20%0D%0A%7B%20%0D%0Auseflag%20%3D%20%22%E6%BF%80%E6%B4%BB%E5%B8%90%E5%8F%B7%22%3B%20%0D%0A%7D%20%0D%0AMenuDiv%20%3D%20document.createElement(%22div%22)%3B%20%0D%0AMenuDiv.id%20%3D%20%22MenuDiv%22%3B%20%0D%0AMenuDiv.onmouseleave%20%3D%20function()%20%0D%0A%7B%20%0D%0AMenuClose()%3B%20%0D%0A%7D%20%0D%0AMenuDiv.style.position%20%3D%20%22absolute%22%3B%20%0D%0AMenuDiv.style.setAttribute(%22zIndex%22%20%2C%22201%22)%3B%20%0D%0AMenuDiv.style.setAttribute(%22backgroundColor%22%20%2C%22%23EFEFEF%22)%3B%20%0D%0AMenuDiv.style.setAttribute(%22Font%22%20%2C%2210pt%22)%3B%20%0D%0AMenuDiv.style.setAttribute(%22width%22%20%2C60)%3B%20%0D%0AMenuDiv.style.setAttribute(%22left%22%20%2Cleft)%3B%20%0D%0AMenuDiv.style.setAttribute(%22top%22%20%2Ctop)%3B%20%0D%0AMenuDiv.innerHTML%20%3D%20%22%3Ctable%20width%3D%5C%22100%25%5C%22%3E%22%20%0D%0A%2B%22%3Ctr%3E%3Ctd%20onclick%3D%5C%22javascript%3ARedirectUrl(1%2C'%22%20%2B%20flag%20%2B%20%22'%2C'%22%20%2B%20operid%20%2B%20%22')%3BMenuClose()%3B%5C%22%20style%3D%5C%22cursor%3Ahand%3Bheight%3A20px%3BColor%3Ablue%3B%5C%22%20onmouseover%3D%5C%22this.style.backgroundColor%3D'%23FFD76B'%3B%5C%22%20onmouseout%3D%5C%22this.style.backgroundColor%3D'%23EFEFEF'%3B%5C%22%20align%3D%5C%22left%5C%22%20valign%3D%5C%22top%5C%22%3E%22%2Buseflag%2B%22%3C%2Ftd%3E%3C%2Ftr%3E%22%20%0D%0A%2B%22%3Ctr%3E%3Ctd%20onclick%3D%5C%22RedirectUrl(0%2C0%2C'%22%20%2B%20operid%20%2B%20%22')%5C%22%20style%3D%5C%22cursor%3Ahand%3Bheight%3A20px%3BColor%3Ablue%3B%5C%22%20onmouseover%3D%5C%22this.style.backgroundColor%3D'%23FFD76B'%3B%5C%22%20onmouseout%3D%5C%22this.style.backgroundColor%3D'%23EFEFEF'%3B%5C%22%20align%3D%5C%22left%5C%22%20valign%3D%5C%22top%5C%22%3E%E4%BF%AE%E6%94%B9%E5%B8%90%E5%8F%B7%3C%2Ftd%3E%3C%2Ftr%3E%22%20%0D%0A%2B%22%3Ctr%3E%3Ctd%20onclick%3D%5C%22javascript%3ARedirectUrl(4%2C0%2C'%22%20%2B%20operid%20%2B%20%22')%5C%22%20style%3D%5C%22cursor%3Ahand%3Bheight%3A20px%3BColor%3Ablue%3B%5C%22%20onmouseover%3D%5C%22this.style.backgroundColor%3D'%23FFD76B'%3B%5C%22%20onmouseout%3D%5C%22this.style.backgroundColor%3D'%23EFEFEF'%3B%5C%22%20align%3D%5C%22left%5C%22%20valign%3D%5C%22top%5C%22%3E%E9%87%8D%E8%AE%BE%E5%AF%86%E7%A0%81%3C%2Ftd%3E%3C%2Ftr%3E%22%20%0D%0A%2B%22%3Ctr%3E%3Ctd%20onclick%3D%5C%22RedirectUrl(2%2C0%2C'%22%20%2B%20operid%20%2B%20%22')%5C%22%20style%3D%5C%22cursor%3Ahand%3Bheight%3A20px%3BColor%3Ablue%3B%5C%22%20onmouseover%3D%5C%22this.style.backgroundColor%3D'%23FFD76B'%3B%5C%22%20onmouseout%3D%5C%22this.style.backgroundColor%3D'%23EFEFEF'%3B%5C%22%20align%3D%5C%22left%5C%22%20valign%3D%5C%22top%5C%22%3E%E8%A7%92%E8%89%B2%E7%AE%A1%E7%90%86%3C%2Ftd%3E%3C%2Ftr%3E%22%20%0D%0A%2B%22%3Ctr%3E%3Ctd%20onclick%3D%5C%22javascript%3ARedirectUrl(3%2C0%2C'%22%20%2B%20operid%20%2B%20%22')%5C%22%20style%3D%5C%22cursor%3Ahand%3Bheight%3A20px%3BColor%3Ablue%3B%5C%22%20onmouseover%3D%5C%22this.style.backgroundColor%3D'%23FFD76B'%3B%5C%22%20onmouseout%3D%5C%22this.style.backgroundColor%3D'%23EFEFEF'%3B%5C%22%20align%3D%5C%22left%5C%22%20valign%3D%5C%22top%5C%22%3E%E5%88%A0%E9%99%A4%E5%B8%90%E5%8F%B7%3C%2Ftd%3E%3C%2Ftr%3E%22%20%0D%0A%2B%22%3C%2Ftable%3E%22%3B%20%0D%0Adocument.body.appendChild(MenuDiv)%3B%20%0D%0A%7D%20%0D%0A%2F%2F%E8%8E%B7%E5%8F%96%E6%8E%A7%E4%BB%B6%E7%9A%84%E9%AB%98%E5%BA%A6%E5%92%8C%E5%AE%BD%E5%BA%A6%20%0D%0Afunction%20getAbsolutePos(e)%20%0D%0A%7B%20%0D%0Avar%20t%3De.offsetTop%3B%20%0D%0Avar%20l%3De.offsetLeft%3B%20%0D%0Awhile(e%3De.offsetParent)%20%0D%0A%7B%20%0D%0At%2B%3De.offsetTop%3B%20%0D%0Al%2B%3De.offsetLeft%3B%20%0D%0A%7D%20%0D%0A%0D%0Avar%20pos%20%3D%20%7B%20x%3A%20l%2C%20y%3A%20t%20%7D%3B%20%0D%0Areturn%20pos%3B%20%0D%0A%7D%20%0D%0A%3C%2Fscript%3E"> <div id="net" onclick="MenuPanel()">管理资源吧代码测试(点击选择)</div> </body>
[Ctrl+A 全选 注:
如需引入外部Js需刷新才能执行
]
教程首页
更多教程