<input type="text" id="inp" /> <a href="#" onclick="document.getElementById('inp').value = 'SUDO';document.getElementById('inp').focus();return false;">Focus () </a>