You need to sign in to do that
Don't have an account?
balakrishna mandula 6
Javascript
I am new to javascript. I want to learn JavaScript with simple example.
Below is the code which is not executing
<apex:page >
<apex:outputPanel >
<apex:pageMessages id="demo"/>
</apex:outputPanel>
<script type = "text/javascript">
function myfunction(){
var l = 10;
var b = 20;
var ar = l * b;
document.getElementById("demo").innerHtml = ar;
}
</script>
</apex:page>
The above code is not giving area.
Please help me out.
Below is the code which is not executing
<apex:page >
<apex:outputPanel >
<apex:pageMessages id="demo"/>
</apex:outputPanel>
<script type = "text/javascript">
function myfunction(){
var l = 10;
var b = 20;
var ar = l * b;
document.getElementById("demo").innerHtml = ar;
}
</script>
</apex:page>
The above code is not giving area.
Please help me out.
your document.getElementById line is incorrect - if you inspect the VF page in Chrome Developer Tools, you will see that VF components are rendered with system-generated Ids, even if you specify the Id in the apex:pageMessages component. Just switch out "document.getElementById("demo").innerHtml = ar;" to:
Where the "somethings" are the system-generated part you will see when you inspect that element.