文本框有得到焦点的事件,用这个事件动态改变层的样式,类似这样,document.getElementById("idname").style.color="#ff0000",

解决方案 »

  1.   

    <table>
    <tr>
    <td width=100><input type=text id="Text1" NAME="Text1" onclick="change(true,bnd);" onblur="change(false,bnd);"></td>
    <td>
    <div id=bnd>
    change this color
    </div>
    </td>
    </tr>
    </table>
    <script>
    function change(flag,bnd)
    {
    if(flag)
    {
    bnd.style.border="1 solid #ff0000";
    bnd.style.color="#cccc00";
    }else
    {
    bnd.style.borderStyle="none";
    bnd.style.color="#000000";
    }
    }

    </script>
      

  2.   

    个人认为楼上的应该更好一些:CutBug(外面的世界很无奈)
    声明一个flag,这样就可以判断他的得到焦点和失去焦点!就很容易做了!
      

  3.   

    右击ViewSource或者保存网站然后打开方式选择记事本,应该可以看到他用了什么方法
      

  4.   

    http://blog.csdn.net/xuStanly/archive/2006/09/10/1204692.aspx
    比那个更酷的,供参考。