Many thanks.<apex:page standardcontroller="Opportunity">
<apex:form id="formId">
<apex:pageblock id="pb">
<apex:pageBlockSection id="Block1" title="Opportunity Information" columns="2">
<apex:inputField id="Warning_message" value="{!Opportunity.Warning_message__c}" />
</apex:pageBlockSection>
</apex:pageblock>
</apex:form>
<script type="text/javascript">
function myFunction()
{
document.getElementById('{!Opportunity.Warning_message__c}').value = "This will not change the value";
document.getElementById('{!Opportunity.Warning_message__c}').innerHTML= "This will not change the value";
document.getElementById('Warning_message').value = "This will not change the value";
document.getElementById('Warning_message').innerHTML= "This will not change the value";
document.getElementById('{!$Component.formId.pb.Block1.Warning_message}').value = "This will not change the value";
}
var msgObj= document.getElementById('{!Opportunity.Warning_message__c}');
msgObj.value = "This will not change the value";
msgObj.innerHTML= "This will not change the value";
</script>
</apex:page>
Change this line
<apex:inputField id="Warning_message" value="{!Opportunity.Warning_message__c}" />
to
<apex:inputField id="Warning_message" styleClass="warningTxtBoxCls" value="{!Opportunity.Warning_message__c}" />
Change Script
This will work definately... enjoy :)<script>
window.onload = function() {
document.getElementsByClassName('warningTxtBoxCls')[0].value = 'This is definately changing the value';
};
</script>