zoukankan
html css js c++ java
Javascript 弹出层
Code
var
docEle
=
function
()
{
return
document.getElementById(arguments[
0
])
||
false
;
}
function
openNewDiv(_id)
{
var
m
=
"
mask
"
;
if
(docEle(_id)) document.removeChild(docEle(_id));
if
(docEle(m)) document.removeChild(docEle(m));
//
新激活图层
var
newDiv
=
document.createElement(
"
div
"
);
newDiv.id
=
_id;
newDiv.style.position
=
"
absolute
"
;
newDiv.style.zIndex
=
"
9999
"
;
newDiv.style.width
=
"
500px
"
;
newDiv.style.height
=
"
300px
"
;
newDiv.style.top
=
"
50px
"
;
//
newDiv.style.left = (parseInt(document.body.scrollWidth) - 300) / 2 + "px"; // 屏幕居中
newDiv.style.background
=
"
#EFEFEF
"
;
newDiv.style.border
=
"
1px solid #860001
"
;
newDiv.style.padding
=
"
5px
"
;
newDiv.innerHTML
=
"
新激活图层内容
"
;
document.body.appendChild(newDiv);
//
mask图层
var
newMask
=
document.createElement(
"
div
"
);
newMask.id
=
m;
newMask.style.position
=
"
absolute
"
;
newMask.style.zIndex
=
"
1
"
;
newMask.style.width
=
document.body.scrollWidth
+
"
px
"
;
newMask.style.height
=
document.body.scrollHeight
+
"
px
"
;
newMask.style.top
=
"
0px
"
;
newMask.style.left
=
"
0px
"
;
//
newMask.style.background = "#000";
newMask.style.filter
=
"
alpha(opacity=90)
"
;
newMask.style.opacity
=
"
0.90
"
;
document.body.appendChild(newMask);
//
关闭mask和新图层
var
newA
=
document.createElement(
"
a
"
);
newA.href
=
"
#
"
;
newA.innerHTML
=
"
返回新闻管理
"
;
newA.onclick
=
function
()
{
document.body.removeChild(docEle(_id));
document.body.removeChild(docEle(m));
return
false
;
}
var
newB
=
document.createElement(
"
a
"
);
newB.href
=
"
#
"
;
newB.innerHTML
=
"
继续添加新闻
"
;
newB.onclick
=
function
()
{
var
items
=
document.body.getElementsByTagName(
"
input
"
);
for
(i
=
0
;i
<
items.lengh;i
++
)
{
items[i].value
=
""
;
}
document.getElementById(
"
ctl00_ContentPlaceHolder1_txt_content
"
).value
=
""
;
document.body.removeChild(docEle(m));
document.body.removeChild(docEle(_id));
return
false
;
}
newDiv.appendChild(newA); newDiv.appendChild(newB);
}
查看全文
相关阅读:
三道趣味题目
iOS开发中使用静态库 .a 文件
java Graphics2D 画图
堆和栈的区别
iOS开发中KVC、KVO简介
GPUImage的简单使用
OC中 self.view.frame.size.height = 100; 不能通过编译的原因
Xcode7 低版本iOS系统上下有黑边的问题
c语言数组赋值
ELF interpreter /libexec/ld-elf32.so.1 not found
原文地址:https://www.cnblogs.com/wgms/p/1151925.html
最新文章
重写和重载
Swift-----static、class定义类方法
Swift-----运算符重载
Swift-----下标(subscript)
Swift-----初始化函数
Swift-----属性观察器(didSet、willSet)
Swift-----存储型属性、计算型属性、类型型属性
Swift-----访问控制(private、fileprivate、internal、public、open)
macOS Sierra U盘USB启动安装盘
errored out in DoExecute, couldn't PrepareToExecuteJITExpression
热门文章
TTTAttributedLabel xib sb lineSpacing not working
UITextField set placeholderColor and UITextField set clearButton Image
UnicodeEncodeError: 'ascii' codec can't encode characters in position 820-823: ordinal not in range(128)
记一次特别的bug
iMac 升级到10.12后,蓝牙不能用
AFNetworking certificate AFNetworking 证书设置
OC JS交互(通常情况下,如果网页写得正规的话,是可以正常交互的,之前就遇到后台写h5始终拿不到事件,元素也拿不到,更别说交互了,真是奇了怪了)
抓取后台给的接口文档网页上的属性及相关说明
iOS中的单例模式
iOS多线程GCD的简单使用
Copyright © 2011-2022 走看看