Standard salesforce actions are available by using javascript and expression syntax with the !URLFOR and $Action keywords.
<apex:page >
<apex:outputLink value="{!URLFOR($Action.Account.New)}">Create New Account</apex:outputLink>
</apex:page>
A function is a set of javascript code which can be called from any point in a page after it has been declared.
Ex: onclick="changeFont();"
Functions can be included on a page basis ,by putting them in <script> tags in the header or Globally by declaring them in an external javascript(.JS) file.
Example
<apex:page >
<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>
Ajax is known as a tool to perform partial page refreshes.Has been used on force.com platform to access the Web services API within javascript.Due to the data binding capabilities of visualforce the need for AJAX for api access disappears.
<apex:page standardController="Account">
<apex:pageBlock title="Hello {!$User.FirstName}!">
You are displaying contacts from the {!account.name} account.
Click a contact's name to view his or her details.
</apex:pageBlock>
<apex:pageBlock title="Contacts">
<apex:form >
<apex:dataTable value="{!account.Contacts}" var="contact" cellPadding="4" border="1">
<apex:column >
<apex:commandLink rerender="detail">
{!contact.Name} <apex:param name="cid" value="{!contact.id}"/>
</apex:commandLink>
</apex:column>
</apex:dataTable>
</apex:form>
</apex:pageBlock>
<apex:outputPanel id="detail">
<apex:actionStatus startText="Requesting...">
<apex:facet name="stop">
<apex:detail subject="{!$CurrentPage.parameters.cid}" relatedList="false" title="false"/>
</apex:facet>
</apex:actionStatus>
</apex:outputPanel>
</apex:page>
<apex:page standardController="Position__c" title="Sample Position Layout Page" showHeader="true" sidebar="true" >
<!-- Uses <apex:actionSupport> to dynamically render the Technical Skills section of the Layout when Dept = IT, Engineering. -->
<apex:sectionHeader title="{!$ObjectType.Position__c.label} Edit" subtitle="New Position"/>
<apex:form >
<apex:pageBlock title="Position Detail" mode="edit" id="thePageBlock">
<apex:pageBlockButtons >
<apex:commandButton value="Save" action="{!save}"/>
<apex:commandButton value="Cancel" action="{!cancel}"/>
</apex:pageBlockButtons>
<apex:actionRegion >
<apex:pageBlockSection title="Information" columns="2">
<apex:inputField value="{!Position__c.name}"/>
<apex:inputField value="{!Position__c.Priority__c}"/>
<apex:inputField value="{!Position__c.Location__c}"/>
<apex:inputField value="{!Position__c.Status__c}"/>
<apex:inputField value="{!Position__c.Type__c}"/>
<apex:inputField value="{!Position__c.Sub_Status__c}"/>
<apex:inputField value="{!Position__c.Department__c}">
<apex:actionSupport event="onchange" rerender="techSkills"/>
</apex:inputField>
<apex:inputField value="{!Position__c.Start_Date__c}"/>
<apex:inputField value="{!Position__c.Pay_Grade__c}"/>
<apex:pageBlockSectionItem />
<apex:inputField value="{!Position__c.Hiring_Manager__c}"/>
<apex:pageBlockSectionItem />
<apex:inputField value="{!Position__c.Duration__c}"/>
<apex:pageBlockSectionItem />
<apex:inputField value="{!Position__c.Legacy_Position_Number__c}"/>
<apex:pageBlockSectionItem />
</apex:pageBlockSection>
</apex:actionRegion>
<apex:outputPanel id="techSkills">
<apex:pageBlockSection id="theSection" title="Technical Skills" columns="2" rendered="{!Position__c.Department__c == 'IT' || Position__c.Department__c == 'Engineering'}">
<apex:inputField value="{!Position__c.Operating_Systems__c}"/>
<apex:inputField value="{!Position__c.Programming_Languages__c}"/>
</apex:pageBlockSection>
</apex:outputPanel>
<apex:pageBlockSection title="Description" columns="1">
<apex:inputField value="{!Position__c.Job_Description__c}" />
<apex:inputField value="{!Position__c.Responsibilities__c}" />
<apex:inputField value="{!Position__c.Skills_Required__c}" />
<apex:inputField value="{!Position__c.Education__c}" />
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>