Non con javascript... e' semplice html:

<input type=text name=mioTxt value="ciao" readonly>

ciao