首页   |   IT资讯   |   综合资讯   |   开发   |   软件   |   问答   |   网络技术   |   网络综合
更多:
当前位置:首页 » 手机数码
文章正文

请问如何设置某个具有特定id的<tr>元素的背景色?在线等!

类型:转载   责任编辑:asp   日期:2007/03/01

    

我就是想在鼠标点击表格某行时高亮显示该行,请问如何写代码呀?  
  我的html源码如下:  
  <form   name="form1"><table>  
  <tr   id="row0"   onclick="select_row(0)">...  
  <tr   id="row1"   onclick="select_row(1)">...  
  ...</table></form>  
  <script   language="javascript">  
  function   select_row(rowid)  
  {  
  //我写这一句出错了,请问正确的怎么写?  
  document.form1.elements["row"+rowid].bgcolor="blue";  
  }  
  </script>

推荐阅读

  • SED860的下载方法 [详细内容]
  • 最高10000元 12月各价位超值本本推荐 [详细内容]
  • i845主板收山 MSI 845PE-V2涨至430 [详细内容]
  • 如何最大限度的避免自己的5510和sim卡被他人... [详细内容]
  • 魅力男人大比拼 为香港金像奖影帝选配MP3(图) [详细内容]
  • 知足者常乐 年底2000元价位最实惠家用相机盘点 [详细内容]
  • 原油涨价 升技NF8-V2今小幅上涨报550元 [详细内容]
  • 网友回答:
    网友:meizz

    eval("document.all.row"+   rowid).bgcolor   =   "blue";

    网友:fason

    <script   language="javascript">  
      function   select_row(rowid)  
      {  
      document.getelementbyid("row"+rowid).bgcolor="blue";  
      }  
      </script>

    网友:jk_10000

    <form   name="form1"><table   width=100%   bgcolor=cccccc   onmouseout="select_row(null)">  
      <tr   id="row0"   onmouseover="select_row(this)"><td>...</td></tr>  
      <tr   id="row0"   onmouseover="select_row(this)"><td>...</td></tr>  
      <tr   id="row0"   onmouseover="select_row(this)"><td>...</td></tr>  
       
       
      </table></form>  
      <script   language="javascript">  
      var   thecurrenttr;  
      function   select_row(obj)  
      {  
      if(thecurrenttr!=null)   thecurrenttr.bgcolor="";  
      thecurrenttr=obj;  
      if(thecurrenttr!=null)   thecurrenttr.bgcolor="blue";  
       
      }  
      </script>  
     

    .
    站内导航:
    IT热门资讯:
      最佳浏览:1024X768 MSIE
    ©2007 jqmk.com.cn All Rights Reserved