Set a text field to read-only in javascript

document.getElementById("myText").readOnly = true;

Note. you should use readOnly - not readonly