<SCRIPT LANGUAGE="JavaScript">
<!--
mytable.style="borderColor:#444444";
//-->
</SCRIPT>
<table id="mytable" style="borderColor:RED">....</table>
<!--
mytable.style="borderColor:#444444";
//-->
</SCRIPT>
<table id="mytable" style="borderColor:RED">....</table>
<!--
function setBorder()
{
mytable.style.borderColor="coral";
}
//-->
</SCRIPT>
<table id="mytable" style="border-Color:blue" border="2">
<tr><td onmouseover="this.style.borderWidth='0.5cm';
this.style.borderColor='blue';
this.style.borderStyle='solid'">aaaaaaaaaaaaaaaaaaaa</td></tr>
</table>
<input type="button" onclick="setBorder();">
<html><head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 1</title><style>
.myStyle
{
border-Color:RED;
}.myStyle2
{
border-Color:blue;
}
</style><script language=javascript>
</script></head><body><table border="1" width="100%" class=mystyle id=myTable>
<tr>
<td width="25%">sfsfs</td>
<td width="25%">sf</td>
<td width="25%"> </td>
<td width="25%"> </td>
</tr>
<tr>
<td width="25%"> </td>
<td width="25%"> </td>
<td width="25%"> </td>
<td width="25%"> </td>
</tr>
</table>
<input type=button value=变蓝边框 onclick="document.all.myTable.className='myStyle2'">
</body></html>
但我的样式为统一期间都是在css文件中定义,而不在每一页面指定style属性,所以不能用大伙说的这种方式.我就是想通过myStyle这个class获取borderColor的值.how can i do?
设置className的方式效率比较低,在批量使用时延迟相当厉害.!