Thread: help please
View Single Post
Old November 14th, 2012, 02:48 PM   #3 (permalink)
StevenHu
Junior Member
 
Join Date: Feb 2011
Location: Orange County
Gender: Male
Posts: 89
 
Device(s): Google/Asus Nexus 7
Carrier: Not Provided

Thanks: 7
Thanked 0 Times in 0 Posts
Default

Think of a function as a mini-program that works when it is triggered to start. For instance, you can have a function that tells the app to return to the previous page. But it doesn't actually take place until the user touches a Back button.

This is a function called goBack(), which tells the app to go back to the previous page:

function goBack()
{
window.history.back();
}

On a page, this Back button is all set to call, or execute, the goBack() function:

<input type='button' value='Back' onclick='goBack()'>

Hope this little example helps you understand functions.
StevenHu is offline  
Reply With Quote