Javascript with Visualforce pages
Javascript is one of key browser technology on Visualforce pages. Javascript provides the framework for communication between other Javascript objects, HTML elements and visualforce controller. This example will explain how can we use javascripts in visualforce pages.
<apex:page>'{!$Component.idName}' : This is the way of passing particular visualforce component id into the javascript.
<script>
function changeFont(input, textid) {
if(input.checked) document.getElementById(textid).style.fontWeight = "bold";
else document.getElementById(textid).style.fontWeight = "normal";
}
</script>
<apex:outputPanel layout="block">
<label for="checkbox">Click this box to change text font: </label>
<input id="checkbox" type="checkbox"
onclick="changeFont(this,'{!$Component.thePanel}');"/>
</apex:outputPanel>
<apex:outputPanel id="thePanel" layout="block">Change me!
</apex:outputPanel>
</apex:page>
How can we change style of a particular tab in tabPanel from apex javaScript ?
ReplyDeletevery nice post. Click here for salesforce interview questions and answers
ReplyDeleteThis blog is nice SalesForce Online Training
ReplyDelete