<apex:page standardController="Contact" id="PageId">
<apex:form id="FormId">
<apex:inputField value="{!Contact.AccountId}" id="FieldId" />
</apex:form>
<script>
var inp = document.getElementById("PageId:FormId:FieldId");
inp.setAttribute("readonly","true");
</script>
</apex:page>