62,074
社区成员
发帖
与我相关
我的任务
分享
//试试
var o = document.getElementById("Div1");
o.style.filter = 'alpha(opacity=40)';
<!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>div层半透明效果[也合适表格]</title>
<style>
body { background:url(http://www.baidu.com/img/logo-yy.gif)}
#layout { position:absolute; border:1px Dotted #006699; background:#fff; filter: alpha(opacity=60); opacity: 0.6;}
</style>
</head>
<body>
<table width=95% border="0" align="Center" cellpadding="6" cellspacing="0" style="border: 1px Dotted #CCCCCC; TABLE-LAYOUT: fixed">
<tr>
<td style="WORD-WRAP: break-word;background:#fff; filter: alpha(opacity=70); opacity: 0.7;"><br />这是在表格中的效果<br />这种效果文字就变得灰暗了<br />其中:70 和 0.7 值自行调节<br /><a href="http://www.xuemu.net">雪幕天涯提供<br /><br /></td>
</tr>
</table>
<br />
<table width=95% border="0" align="Center" cellpadding="6" cellspacing="0" style="border: 1px Dotted #CCCCCC; TABLE-LAYOUT: fixed">
<tr>
<td style="WORD-WRAP: break-word;background:#fff; filter: alpha(opacity=70); opacity: 0.7;"><div style="position:relative;"><br />这是在表格中的效果,<br />这种效果文字颜色不变<br />其中:70 和 0.7 值自行调节<br /><a href="http://www.xuemu.net">雪幕天涯提供<br /><br /></div></td>
</tr>
</table>
<br />
<div id="layout"><br />这是在<font color="#FF0000">DIV</font>中的效果<br />其中:60 和 0.6 值自行调节<br /><a href="http://www.xuemu.net">雪幕天涯提供<br /><br /></div>
</body>
</html>