You need to sign in to do that
Don't have an account?

javascript in vf page not working please correct it
<apex:page >
<script type="text/javascript">
function validate()
{
document.getElementById('demo').innerhtml='hello js'
}
</script>
<html>
<body>
<h1>Congratulations</h1>
<p id="demo">This is your new Page: js1</p>
<apex:form >
<apex:commandButton value="Insert" onclick="validate();"/>
</apex:form>
</body>
</html>
</apex:page>
<script type="text/javascript">
function validate()
{
document.getElementById('demo').innerhtml='hello js'
}
</script>
<html>
<body>
<h1>Congratulations</h1>
<p id="demo">This is your new Page: js1</p>
<apex:form >
<apex:commandButton value="Insert" onclick="validate();"/>
</apex:form>
</body>
</html>
</apex:page>
Javascript is casesensitive so use "innerHTML" instead of "innerhtml".
ONe more thing, command button will reload you vf page after clicking it. Here you can user HTML input button as well.
All Answers
try this ...its working fine for me
Javascript is casesensitive so use "innerHTML" instead of "innerhtml".
ONe more thing, command button will reload you vf page after clicking it. Here you can user HTML input button as well.