搬运的留着以后自己看!
复制下面蓝色的代码保存为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层透明,由浅变深
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件!
如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
暂无“javascript控制Div层透明属性由浅变深由深变浅逐渐显示”评论...
P70系列延期,华为新旗舰将在下月发布
3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。
而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?
根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。
更新动态
2024年05月09日
2024年05月09日
- 《依盖之书》基础攻略 简述+配置+下载
- 发烧精选(雅瑟音响试音碟)VA-《UsherAudioDemonstation》CD1【ELAC】
- 发烧精选(雅瑟音响试音碟)VA-《UsherAudioDemonstation》CD2【ELAC】
- SYMPHONIESINHI-FI1(发烧交响乐1)MQGCD2020原抓WAV
- 玩家称《剑星》服装致敬杀死比尔 网友:明明是李小龙
- 索尼取消强绑PSN账号 玩家热议:污点已无法抹去
- 《死亡搁浅》玛玛演员玛格丽特·库里新片剧照 造型美艳至极
- 农夫.2023-农夫散文集【乐腾】【FLAC分轨】
- 黄格选.1993-伤心事一种说不出的痛【先科娱乐】【WAV+CUE】
- 群星.1993-宝丽金美少女宣言6CD【宝丽金】【WAV+CUE】
- 大生意隐藏任务哪里接?大生意任务攻略
- 周深《晚安明天见 TMElive超现场》[WAV/分轨][700MB]
- 群星 再次征服挑剔的耳朵《发烧天籁女声 5CD》[WAV+CUE][3.3GB]
- 费玉清《一剪梅 HQCD 不朽的经典》[WAV+CUE][670MB]
- 西游笔绘西行新手攻略 新手入门指南分享