var myexample="";
var bnm=""; 
function  flashit1(t)
{var bnm="myexample" + t;
bnm.style.borderColor="#cccccc";
}bnm无法得到myexample1,myexample2,myexample3,.。

解决方案 »

  1.   

    如果你想得到元素的样式用下面的函数
    function getStyle(obj,which){
        return obj.currentStyle?
               obj.currentStyle[which]:
               document.defaultView.getComputedStyle (obj,null)[which];
    }
    var obrderColor = getStyle(document.getElementById(元素的id));
    你这里bnm是一个字符串,这还加神马样式?没见过这么玩的。
      

  2.   

    这么复杂?我只想当鼠标进入和出来的时候给表格边框加上不同颜色:
    function o(t)
    if t=1
    myexample1.style.borderColor="#cccccc";if t=2
    myexample2.style.borderColor="#cccccc";if t=3
    myexample3.style.borderColor="#cccccc";...
    function r(s)
    if t=1
    myexample1.style.borderColor="#cccccc";if t=2
    myexample2.style.borderColor="#cccccc";if t=3
    myexample3.style.borderColor="#cccccc";...如果太复杂,不如一个一个函数写的好?
      

  3.   

    不好意思写错了,补充一下。function o(t)
    if t=1
    myexample1.style.borderColor="#cccccc";if t=2
    myexample2.style.borderColor="#cccccc";if t=3
    myexample3.style.borderColor="#cccccc";...
    function r(s)
    if s=1
    myexample1.style.borderColor="#ffcccc";if s=2
    myexample2.style.borderColor="#ffcccc";if s=3
    myexample3.style.borderColor="#ffcccc";...
      

  4.   

    var myexample="";
    var bnm="";  
    function flashit1(t)
    {eval("myexample" + t+".style.borderColor=\"#cccccc\");
    }
      

  5.   


    function  flashit1(t)
    {var bnm="myexample" + t;
    bnm.style.borderColor="#cccccc";
    }function  flashit2(s)
    {var bnm="myexample" + s;
    bnm.style.borderColor="#23B3DC";
    }  
    <table width="60" border="0" cellpadding="0" cellspacing="0"  id="myexample1"  style="border:1px solid <%=bubgbg%>">
                              <tr> 
                                <td height="20" bordercolor="#0099CC"> <div align="center"><a href="#" onmouseover="flashit1(1)" onmouseout="flashit2(1)">记录一</a></div></td>
                              </tr>
                            </table>
     <table width="60" border="0" cellpadding="0" cellspacing="0" id="myexample2"  style="border:1px solid <%=bubgbg%>">
                              <tr> 
                                <td height="20" bordercolor="#0099CC"> <div align="center"><a href="#" onmouseover="flashit2(2)" onmouseout="flashit2(2)">记录二 </a></div></td>
                              </tr>
                            </table>
      

  6.   


    首先,你最好用style将bordercolor属性重写,而不要试图直接用html中的标签,(因为我没有这么做过),其次你的函数根本没有获取该对象,怎么能够取得或设置对象的属性呢,你需要用document.getElementById等函数取得某个对象,如
    var document.getElementById(***).style.boderColor = ****
    最后,直接使用style属性貌似只能改变内链样式,对于外链样式还另有一套方法,希望有点用function flashit1(t)
    {var bnm="myexample" + t;
    document.getElementById(bnm).style = "border:1px solid #cccccc";
    //bnm.style.borderColor="#cccccc";
    }
      

  7.   

    style.borderColor="#fff #000 #000 #fff"