无为清净楼资源网 Design By www.qnjia.com
搬运的留着以后自己看!
复制下面蓝色的代码保存为html格式的文件,使用网页浏览器浏览效果
代码支持IE6、7、8/firefox/Chrome浏览器
复制代码 代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>javascript控制Div层透明属性,由浅变深逐渐显示,由深变浅逐渐消失</title>
<script>
var SysIsIE;
var ua = navigator.userAgent.toLowerCase();
var s;(s = ua.match(/msie ([\d.]+)/)) ? SysIsIE = s[1] : 0;
function Q(s){
return document.getElementById(s);
}
function dvck(){
idstr='tian';
e=Q(idstr);
if(e){
e.parentNode.removeChild(e);
}
var div=document.createElement("div");
div.style.position="absolute";
div.style.top='10%';
div.style.left='40%';
div.style.cssText='filter: alpha(opacity=10);opacity:0.1;position:absolute;top:50%;left:50%;width:544px;height:354px;margin-top:-177px;margin-left:-272px;;background-color:#000';
div.id=idstr;
//div.innerHTML='<img src="/UploadFiles/2021-04-02/i.jpg">div.innerHTML='<p style="color:#fff;text-align:center;">div层显示的内容,author:<a href="http://hi.baidu.com/bluid" style="color:#FBFC4D">bluid</a><br><br><br><br><br><a href="javascript:cleand(\''+idstr+'\')" style="color:#FEF8C3">关闭</a></p>';
document.body.appendChild(div);
if (SysIsIE)
dcbIE(idstr,'+');
else
dcboth(idstr,'+');
}
function dcbIE(s,j){
o=Q(s);
opc=parseInt(o.filters.alpha.opacity);
if(j=='+'){
if(opc<100){
o.filters.alpha.opacity=(opc+10)+'';
setTimeout("dcbIE('"+s+"','"+j+"')",100);
}
}else if(j=='-'){
if(opc>0){
o.filters.alpha.opacity=(opc-10)+'';
setTimeout("cleand('"+s+"','"+j+"')",100);
}
}
}
function dcboth(s,j){
o=Q(s);
opc=parseFloat(o.style.opacity);
if(j=='+'){
if(opc<1){
o.style.opacity=(opc+0.1)+'';
//setInterval("dcboth('"+s+"')",3000);
setTimeout("dcboth('"+s+"','"+j+"')",100);
}
}else if(j=='-'){
if(opc>0){
o.style.opacity=(opc-0.1)+'';
setTimeout("cleand('"+s+"','"+j+"')",100);
}
}
}
function cleand(s){
if (SysIsIE){
dcbIE(s,'-');
}else{
dcboth(s,'-');
}
}
</script>
</head>
<body>
<div><br><br>
<p style="font-size:14px">javascript控制Div层透明属性,由浅变深逐渐显示,由深变浅逐渐消失.</p><br><br>
<br><br><br>
<p>单击'click'显示层,由浅变深逐渐显示</p><br><br><br><br>
<a href="javascript:dvck()">click</a><br><br><br><br>
<p>在显示的层上单击,可以由深变浅逐渐消失</p>
<br><br><br>
<p>
<!-- #BeginDate format:Am3m -->02/11/2011 16:17<!-- #EndDate --> --- author:<a href="http://hi.baidu.com/bluid">bluid</a>
</p>
<br><br><br><br>
<br><br>
</div>
</body>
</html>
复制下面蓝色的代码保存为html格式的文件,使用网页浏览器浏览效果
代码支持IE6、7、8/firefox/Chrome浏览器
复制代码 代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>javascript控制Div层透明属性,由浅变深逐渐显示,由深变浅逐渐消失</title>
<script>
var SysIsIE;
var ua = navigator.userAgent.toLowerCase();
var s;(s = ua.match(/msie ([\d.]+)/)) ? SysIsIE = s[1] : 0;
function Q(s){
return document.getElementById(s);
}
function dvck(){
idstr='tian';
e=Q(idstr);
if(e){
e.parentNode.removeChild(e);
}
var div=document.createElement("div");
div.style.position="absolute";
div.style.top='10%';
div.style.left='40%';
div.style.cssText='filter: alpha(opacity=10);opacity:0.1;position:absolute;top:50%;left:50%;width:544px;height:354px;margin-top:-177px;margin-left:-272px;;background-color:#000';
div.id=idstr;
//div.innerHTML='<img src="/UploadFiles/2021-04-02/i.jpg">div.innerHTML='<p style="color:#fff;text-align:center;">div层显示的内容,author:<a href="http://hi.baidu.com/bluid" style="color:#FBFC4D">bluid</a><br><br><br><br><br><a href="javascript:cleand(\''+idstr+'\')" style="color:#FEF8C3">关闭</a></p>';
document.body.appendChild(div);
if (SysIsIE)
dcbIE(idstr,'+');
else
dcboth(idstr,'+');
}
function dcbIE(s,j){
o=Q(s);
opc=parseInt(o.filters.alpha.opacity);
if(j=='+'){
if(opc<100){
o.filters.alpha.opacity=(opc+10)+'';
setTimeout("dcbIE('"+s+"','"+j+"')",100);
}
}else if(j=='-'){
if(opc>0){
o.filters.alpha.opacity=(opc-10)+'';
setTimeout("cleand('"+s+"','"+j+"')",100);
}
}
}
function dcboth(s,j){
o=Q(s);
opc=parseFloat(o.style.opacity);
if(j=='+'){
if(opc<1){
o.style.opacity=(opc+0.1)+'';
//setInterval("dcboth('"+s+"')",3000);
setTimeout("dcboth('"+s+"','"+j+"')",100);
}
}else if(j=='-'){
if(opc>0){
o.style.opacity=(opc-0.1)+'';
setTimeout("cleand('"+s+"','"+j+"')",100);
}
}
}
function cleand(s){
if (SysIsIE){
dcbIE(s,'-');
}else{
dcboth(s,'-');
}
}
</script>
</head>
<body>
<div><br><br>
<p style="font-size:14px">javascript控制Div层透明属性,由浅变深逐渐显示,由深变浅逐渐消失.</p><br><br>
<br><br><br>
<p>单击'click'显示层,由浅变深逐渐显示</p><br><br><br><br>
<a href="javascript:dvck()">click</a><br><br><br><br>
<p>在显示的层上单击,可以由深变浅逐渐消失</p>
<br><br><br>
<p>
<!-- #BeginDate format:Am3m -->02/11/2011 16:17<!-- #EndDate --> --- author:<a href="http://hi.baidu.com/bluid">bluid</a>
</p>
<br><br><br><br>
<br><br>
</div>
</body>
</html>
标签:
Div层透明,由浅变深
无为清净楼资源网 Design By www.qnjia.com
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
无为清净楼资源网 Design By www.qnjia.com
暂无评论...
更新日志
2024年09月30日
2024年09月30日
- 纪钧瀚《钢琴阅读时光 雨中书店聆听轻音乐》[FLAC/分轨][399.62MB]
- 证声音乐图书馆《走向自然 疗心爵士乐》[320K/MP3][87.4MB]
- 证声音乐图书馆《走向自然 疗心爵士乐》[FLAC/分轨][184.94MB]
- 陈慧娴.2018-Priscilla-Ism演唱会3CD(2024环球红馆40复刻系列)【环球】【WAV+CUE】
- 郑秀文.1999-我应该得到(国)【华纳】【WAV+CUE】
- 陈家慧.2011-钢琴酒吧2CD【龙吟唱片】【WAV+CUE】
- 证声音乐图书馆《雨季 蓝调吉他 Rainy Blues》[320K/MP3][45.01MB]
- 证声音乐图书馆《雨季 蓝调吉他 Rainy Blues》[FLAC/分轨][109.13MB]
- 赞多《序章》[320K/MP3][45.54MB]
- 许巍.2004-每一刻都是崭新的【步升大风】【WAV+CUE】
- 群星.2024-四方馆影视原声带【韶愔音乐】【FLAC分轨】
- 陈雷.1997-安锁咧【金圆唱片】【WAV+CUE】
- 关淑怡.2013-MY.FAVORITE.SK.3CD【环球】【WAV+CUE】
- Sweety.2006-花言乔语【丰华】【WAV+CUE】
- 李恕权.2003-回·20年全精选2CD【SONY】【WAV+CUE】