写一个onfocus方法应该就可以实现吧

解决方案 »

  1.   

    <script language="javascript">
    function changeState()
    {
      document.getElementById("button1").disabled=false;
    }
    window.onload=function(){
      document.getElementById("button1").disabled=true;
    }
    </script>
    <input type="text" onfocus="changeState()"/><input id="button1" type="button" value="Test" />
      

  2.   

    <html>
    <script type="text/javascript">
    function a(tb)
    {
        var str = tb.value;
        if(str != '')
            document.getElementById('Button1').disabled = '';
    }
    </script>
    <body>
        <input id="Text1" type="text" onkeydown="a(this)" /><input id="Button1" type="button" value="button" disabled="disabled" />
    </body>
    </html>