错在这一句上了
theRowObject.cells[j].style = "",style不能直接赋值
function checkOtherTD(theTDObject)
{
var theTableObject = document.getElementById("theTable");
for(var i=0;i < theTableObject.rows.length;i++)
{   
var theRowObject = theTableObject.rows[i];
for(var j=0;j<theRowObject.cells.length;j++)
{         
if(theRowObject.cells[j] == theTDObject)
 ;
else
{
theRowObject.cells[j].style.borderLeft   = "";
theRowObject.cells[j].style.borderRight  = "";
theRowObject.cells[j].style.borderTop    = "";
theRowObject.cells[j].style.borderBottom = "";
theRowObject.cells[j].style.padding      = "";
theRowObject.cells[j].style.cursor  = "";
theRowObject.cells[j].style.backgroundColor  = "";
}
}   
}
}

解决方案 »

  1.   

    这样简单点吧
    <body bgcolor="#FFFFFF">
    <Table>
        <TR>
                <TD><img src="1.gif"></TD>
                <TD><img src="2.gif"></TD>
                <TD><img src="3.gif"></TD>
                <TD><img src="4.gif"></TD>
                <TD><img src="5.gif"></TD>
         </TR>
         <TR>
                <TD><img src="6.gif"></TD>
                <TD><img src="7.gif"></TD>
                <TD><img src="8.gif"></TD>
                <TD><img src="9.gif"></TD>
                <TD><img src="10.gif"></TD>
         </TR>       ......
    </Table>
    <script language="JavaScript">
    <!--
    var theImgObject = document.getElementsByTagName("img");
    for(var i=0;i<theImgObject.length;i++)
    {
       theImgObject[i].onclick=imgClick;
    }var oldObj;
    function imgClick()
    {
        var obj = event.srcElement.parentElement;
    if(typeof oldObj != "object")
    {
    oldObj = obj;
       }
       else
       {
            oldObj.style.borderLeft   = "";
    oldObj.style.borderRight  = "";
    oldObj.style.borderTop    = "";
    oldObj.style.borderBottom = "";
    oldObj.style.padding      = "";
    oldObj.style.backgroundColor  = "";
    oldObj = obj;
       }
       addStyle(obj);
    }function addStyle(obj)
    {
    obj.style.borderLeft   = "1px solid buttonhighlight";
    obj.style.borderRight  = "1px solid buttonshadow";
    obj.style.borderTop    = "1px solid  buttonhighlight";
    obj.style.borderBottom = "1px solid buttonshadow";
    obj.style.padding      = "1px";
    obj.style.backgroundColor  = "#cccccc";
    oldObj = obj;
    }
    //-->
    </script>
    </body>
      

  2.   

    <Table id=theTable>
        <TR>
                <TD><img src="1.gif" id=iii></TD>
                <TD><img src="2.gif"></TD>
                <TD><img src="3.gif"></TD>
                <TD><img src="4.gif"></TD>
                <TD><img src="5.gif"></TD>
         </TR>
         <TR>
                <TD><img src="6.gif"></TD>
                <TD><img src="7.gif"></TD>
                <TD><img src="8.gif"></TD>
                <TD><img src="9.gif"></TD>
                <TD><img src="10.gif"></TD>
         </TR></Table><script>
    var theImgObject = document.all.theTable.getElementsByTagName("img")
    for(var i=0;i<theImgObject.length;i++)
    {
    theImgObject[i].onclick = function()
    {
    checkOtherTD()
    this.style.borderLeft   = "1px solid buttonhighlight";
    this.style.borderRight  = "1px solid buttonshadow";
    this.style.borderTop    = "1px solid  buttonhighlight";
    this.style.borderBottom = "1px solid buttonshadow";
    this.style.padding      = "1px";
    this.style.cursor  = "default"
    this.style.backgroundColor  = "#cccccc";
    }
    }
    function checkOtherTD()
    {
    var theTableObject = document.all.theTable.getElementsByTagName("TD")
    for(var i=0;i < theTableObject.length;i++)
    {
    theTableObject[i].childNodes(0).style.cssText = ""
    }
    }
    </script>
      

  3.   

    LxcJie(肖冲) 非常谢谢你
    还有这个问题:
    ========================================================
    function Initlize(){ var theImgObject = document.getElementsByTagName("img")
                   for(var i=0;i<theImgObject.length;i++){            with(theImgObject[i]){

    onclick = new function(){    //new function() 和 function()这里的效果是不一样的

                var theTD = parentElement     checkOtherTD(src)
                    .....

    }
      
      }

      
         
      
    }
    }这里的  onclick = new function(){}与   
        onclick = function(){}写法效果是不一样的,动态表单对象添加事件我看了是onclick = new function{}
    这种写法
    不知道怎么回事,两者有什么区别吗?==================================================
    而且必须是
    with(theImgObject[i])
    {
       var theTD = parentElement
         onclick = function(){
            checkotherTD(src) 
         }}如果不用withvar theTD = theImgObject[i].parentElement
    theImgObject[i].onclick = function{  checkotherTD(theImgObject[i].src) 
    }
    将不认识theImgObject[i].srtc属性和方法,
    能帮我解决吗?
    =======================================================
    马上揭帖
      

  4.   

    onclick = function(){}
    是使用的函数直接量至于with,两种用法是一样的,我看到你写的
    theImgObject[i].onclick = function{  checkotherTD(theImgObject[i].src) 
    }function落下一个(),是不是这个原因
      

  5.   

    theImgObject[i].onclick = function(){    //new function() 和 function()这里的效果是不一样的
    var theTD = theImgObject[i].parentElement

    theTD.style.borderLeft   = "1px solid buttonhighlight";
    theTD.style.borderRight  = "1px solid buttonshadow";
    theTD.style.borderTop    = "1px solid  buttonhighlight";
    theTD.style.borderBottom = "1px solid buttonshadow";
    theTD.style.padding      = "1px";
    theTD.style.cursor  = "default"
    theTD.style.backgroundColor  = "#cccccc"; theImgSrc.value = theImgObject[i].src

    //checkOtherTD(theImgObject[i].src)
    }
    theImgSrc.value = theImgObject[i].src  这里报错~~
      

  6.   

    sorry,是这里报错var theTD = theImgObject[i].parentElement