VS.NET 2005中。我想用以下JS脚本动态改变TABLE的Filter属性。
结果却没有任何反映。。为什么?
-----------------------------
js function
function SetClassName(obj,bools)
{
if(bools)
{
//if(obj.className!= "ListB ")
//{
//obj.className= "ListB ";
//}
obj.className=null;
obj.style.filter= "progid:DXImageTransform.Microsoft.Gradient(startColorStr=#FFFFFF, endColorStr=#ffcc66, gradientType=0) ";
}
else
{
obj.className= "ListA ";
}
}
回复可以解决问题的有分。顶一下 5分.
------解决方案--------------------------------------------------------
这个应该和浏览器版本有关吧
------解决方案--------------------------------------------------------
startColorStr=#FFFFFF, endColorStr=#ffcc66
色差太小!!!
startColorStr=#00ff00, endColorStr=#ff0000
绿配红你再看!
代码如下:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN ">
<html>
<head>
<title> New Document </title>
<meta name= "Generator " content= "EditPlus ">
<meta name= "Author " content= " ">
<meta name= "Keywords " content= " ">
<meta name= "Description " content= " ">
<STYLE TYPE= "text/css ">
.ListA
{
background-color: red;
}
</STYLE>
</head>
<body>
<table id= "tblSample " class= "ListA ">
<tr>
<td> A </td>
<td> B </td>
</tr>
<tr>
<td> C </td>
<td> D </td>
</tr>
</table>
<input type= "button " id= "btnSet " value= "Set " onclick= "SetClassName(document.getElementById( 'tblSample '), true); ">
<input type= "button " id= "btnClear " value= "Clear " onclick= "SetClassName(document.getElementById( 'tblSample '), false); ">
</body>
<script language= "JavaScript ">
<!--
function SetClassName(obj,bools)
{
if(bools)
{
obj.className = null;
obj.style.filter= "progid:DXImageTransform.Microsoft.Gradient(startColorStr=#00ff00, endColorStr=#ff0000, gradientType=0) ";
}
else
{
obj.style.filter = null;
obj.className= "ListA ";
}
}
//-->
</script>
</html>
------解决方案--------------------------------------------------------
顶下5分,我多顶几下是不是会多给些,呵呵,
没试过这个功能,只能帮你顶了
------解决方案--------------------------------------------------------
偶错了
开始的确是色差看不出来
调高了才看出来的
下面是完整的示例
与高度无关