解决方案 »

  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>
    <style type="text/css">
    .test{
    background-color:#F00;
    }
    </style>
    <script type="text/javascript">
    function change(t,n){
    var p=t.parentNode;
    if(n==1){
    p.className='';
    t.className='test';
    }else{
    p.className='test';
    t.className='';
    }
    }
    </script>
    </head><body>
    <table>
    <tr>
         <td class="test">test<input type="text" onclick="change(this,1)" onblur="change(this,0)"></td>
        </tr>
    </table>
    </body>
    </html>
    类似这样?
      

  2.   

    你楼上做的就是你所描述的效果,他做的是:点击时清除了td的样式,变更了输入框的样式,失去焦点后还原视觉上的效果不同,自己调整样式定义
    功能上的效果有偏差,自己调整js即可[看你的两个截图,并不像你文字所描述的那样,好像就只是改变了输入框的样式而已]
      

  3.   


    借楼上的改改,是这样吗
    <!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>
    <style type="text/css">
    .test{
    border:1px solid red;
    }
    </style>
    <script type="text/javascript">
    function change(t,n){
    if(n==1){
    t.className='test';
    }else{
    t.className='';
    }
    }
    </script>
    </head><body>
    <table>
    <tr>
         <td>test<input type="text" onclick="change(this,1)" onblur="change(this,0)"></td>
        </tr>
    </table>
    </body>
    </html>