function hdmdiy(n)
{            $("#showcontent").html(eval('str'+n));
  $("#tag1").attr("border-bottom-width","1px");}
<tr id="newsmenu">
                <td width="145" height="30" style="BORDER-RIGHT: #666666 0px solid; BORDER-TOP: #666666 1px solid; BORDER-LEFT: #666666 1px solid; BORDER-BOTTOM: #666666 0px solid"  onmouseover="hdmdiy(1)" id="tag1"><div align="center">要闻</div></td>
                <td width="145" style="BORDER-RIGHT: #666666 0px solid; BORDER-TOP: #666666 1px solid; BORDER-LEFT: #666666 1px solid; BORDER-BOTTOM: #666666 1px solid" onmouseover="hdmdiy(2)" id="tag2"><div align="center">媒体</div></td>
                <td width="145" style="BORDER-RIGHT: #666666 0px solid; BORDER-TOP: #666666 1px solid; BORDER-LEFT: #666666 1px solid; BORDER-BOTTOM: #666666 1px solid" onmouseover="hdmdiy(3)" id="tag3"><div align="center">动态</div></td>
                <td width="145" style="BORDER-RIGHT: #666666 1px solid; BORDER-TOP: #666666 1px solid; BORDER-LEFT: #666666 1px solid; BORDER-BOTTOM: #666666 1px solid" onmouseover="hdmdiy(4)" id="tag4"><div align="center">之窗</div></td>
              </tr>
问题1:  attr("border-bottom-width","1px"); 改边框宽度无效果问题2:    我希望做成根据n值动态定位标签的效果类似   $(eval("#tag"+n)).attr   正确的应该怎么写

解决方案 »

  1.   

    <!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=utf-8" />
    <title></title>
    <script src="http://www.liuxiaofan.com/demo/js/jquery-1.6.4.min.js" type="text/javascript"></script></head>
    <body>
    <table>
    <tr id="newsmenu">
      <td width="145" height="30" style="BORDER-RIGHT: #666666 0px solid; BORDER-TOP: #666666 1px solid; BORDER-LEFT: #666666 1px solid; BORDER-BOTTOM: #666666 0px solid" onmouseover="hdmdiy(1)" id="tag1"><div align="center">要闻</div></td>
      <td width="145" style="BORDER-RIGHT: #666666 0px solid; BORDER-TOP: #666666 1px solid; BORDER-LEFT: #666666 1px solid; BORDER-BOTTOM: #666666 0px solid" onmouseover="hdmdiy(2)" id="tag2"><div align="center">媒体</div></td>
      <td width="145" style="BORDER-RIGHT: #666666 0px solid; BORDER-TOP: #666666 1px solid; BORDER-LEFT: #666666 1px solid; BORDER-BOTTOM: #666666 0px solid" onmouseover="hdmdiy(3)" id="tag3"><div align="center">动态</div></td>
      <td width="145" style="BORDER-RIGHT: #666666 1px solid; BORDER-TOP: #666666 1px solid; BORDER-LEFT: #666666 1px solid; BORDER-BOTTOM: #666666 0px solid" onmouseover="hdmdiy(4)" id="tag4"><div align="center">之窗</div></td>
      </tr>
      </table>
      <div id="showcontent"></div>
    <script>
    function hdmdiy(n)
    {
      $("#showcontent").html('str'+n);
      $("#tag"+n).css({"border-bottom-width":"1px"});}
    </script>
    </body>
    </html>
      

  2.   


    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
    <script type="text/javascript">
    function hdmdiy(n)
    { // $("#showcontent").html(eval('str'+n));
     $("#tag" + n).css("border-bottom-width","1px");}
    </script>
    <table>
    <tr id="newsmenu">
      <td width="145" height="30" style="BORDER-RIGHT: #666666 0px solid; BORDER-TOP: #666666 1px solid; BORDER-LEFT: #666666 1px solid; BORDER-BOTTOM: #666666 0px solid" onmouseover="hdmdiy(1)" id="tag1"><div align="center">要闻</div></td>
      <td width="145" style="BORDER-RIGHT: #666666 0px solid; BORDER-TOP: #666666 1px solid; BORDER-LEFT: #666666 1px solid; BORDER-BOTTOM: #666666 1px solid" onmouseover="hdmdiy(2)" id="tag2"><div align="center">媒体</div></td>
      <td width="145" style="BORDER-RIGHT: #666666 0px solid; BORDER-TOP: #666666 1px solid; BORDER-LEFT: #666666 1px solid; BORDER-BOTTOM: #666666 1px solid" onmouseover="hdmdiy(3)" id="tag3"><div align="center">动态</div></td>
      <td width="145" style="BORDER-RIGHT: #666666 1px solid; BORDER-TOP: #666666 1px solid; BORDER-LEFT: #666666 1px solid; BORDER-BOTTOM: #666666 1px solid" onmouseover="hdmdiy(4)" id="tag4"><div align="center">之窗</div></td>
      </tr>
    </table>
      

  3.   

    The "border-bottom-width" property does not work if it is used alone. Use the "border-style" property to set the borders first.