<input type="text" id="txt" name="txt"  onkeyup="checkFnc(this);" />
<input type="button" value="buton" id="btn" name="btn" disabled/>


<script>

function checkFnc(elem)
{
    if(elem)
    {
        var btElem = document.getElementById("btn");
        if(btElem)
        {
            btElem.disabled = elem.value.length == 0;
        }
    }
}

</script>