当前位置: 代码迷 >> ASP >> 改变样式?解决办法
  详细解决方案

改变样式?解决办法

热度:122   发布时间:2012-03-13 11:21:10.0
改变样式?
<%   do   while   not   rsMain.Eof   %>
<td   height= "158 "   valign= "top ">
<table   border= "0 "   cellspacing= "0 "   cellpadding= "0 ">
    <tr>
        <td   height= "143 "   valign= "top ">
<%
If   rsMain( "MainProduct ")   Then
%>
<a   href= " <%=rsMain( "MainProductLink ")%> "> <img   src= "../../ProductPictures/SmallPictures/ <%=rsMain( "SmallPicture ")%> "   width= "240 "   height= "150 "   border= "0 "   /> </a>
<%
Else
%>
<a   href= "Product_model.asp?CategoryID= <%=rsMain( "CategoryID ")%> &ProductNumber= <%=rsMain( "ProductNumber ")%> &Page= <%=Current_Page%> &ScaleFlag= <%=rsMain( "Scale ")%> "> <img   src= "../../ProductPictures/SmallPictures/ <%=rsMain( "SmallPicture ")%> "   width= "240 "   height= "141 "   border= "0 "   /> </a>
<%
End   If
%>
</td>
    </tr>
<tr> <td   height= "15 "   align= "center "   valign= "top "   class= "Arial-B "> <%=rsMain( "ProductNumber ")%> </td> </tr>
</table>
</td>
<%   rsMain.MoveNext
      loop
%>

现在想要在这个 <table> 里头的第二个 <tr> <td> ... </td> </tr> 这里头改变成动态的样式,样式已经改好了,像这样

起先加载的是Arial-N
.Arial-N   {
font-family:   Arial,   Helvetica,   sans-serif;
font-weight:   bolder;
color:   #FFFFFF;
font-style:   italic;
letter-spacing:1pt;
background-image:url(../Images/black.gif);
}
鼠标一移动到 <table> 里头的第二个 <tr> <theight= "15 "   align= "center "   valign= "top "   class= "Arial-B "> <%=rsMain( "ProductNumber ")%> </td> </tr>
就改变成这样的样式:
.Arial-M   {
font-family:Arial,   Helvetica,   sans-serif;
font-weight:bolder;
color:#ffffff;
font-style:italic;
letter-spacing:1pt;
background-image:url(../Images/red.gif)
}

该怎么办呢?谢谢!

------解决方案--------------------
在某处加一个脚本
<script language= "javascript ">
function mouseOut(obj)
{
obj.className = "Arial-M "
}
function mouseOver(obj)
{
obj.className = "Arial-N "
}
</script>
然后再那个TD处写这个
<td id = "td1 " height= "15 " align= "center " valign= "top " class= "Arial-M " onmouseover= "mouseOver(this); " onmouseout= "mouseOut(this); "> <%=rsMain( "ProductNumber ")%> </td>
  相关解决方案