<input type="text" id="inp"/>
[JS]
<script>
var inp = document.getElementById('inp');
inp.addEventListener('blur', function (e) {
e = e.target || e.srcElement;
if(e.value.substring(0,2).toLowerCase() == 'td') alert('ok');
else alert('no')
}, false);
</script>
[/JS]