Sponsored Links
JavaScript Tutorials
- JavaScript Browser Objects Part 2
- JavaScript Frame object
- JavaScript Form Object
- JavaScript FileUpload Object
- JavaScript Event Object Properties and Methods
- JavaScript Event Object
- JavaScript Elements and Embed Objects
- JavaScript Applet Objects
- JavaScript Browser Objects
- JavaScript Object Oriented Features
- JavaScript Window Object Open Method Part 2
- JavaScript Window Object Open Method
- JavaScript Window Object Timeout Methods
- JavaScript Location Object
- JavaScript Location Object Properties
- JavaScript History Object Properties and Methods
- JavaScript Document Object Methods Part II
- JavaScript Document Object Methods Part I
- JavaScript Document Object Properties
- JavaScript Document Object
Tutorials
JavaScriptPassing values to JavaScript Function
Passing values to JavaScript Function
Passing values to JavaScript Function
In this JavaScript Tutorial you will learn about how to pass values to and also how to return values from a JavaScript function.
Passing Values to function:
Values can be passed to a function as parameters.
The general syntax for passing values to a function in JavaScript is:
………………………………………… }
function name_of_function(argument1,argument2,…argumentn)
{
//Block of Code
…………………………………………
In the above argument1, argument2,...argumentn represents the values passed to the function.
For Example:
Suppose a programmer wants to create a function with name exforsys, which takes two values x and y.
These two values are passed from the calling program. Then function takes up the shape as follows:
………………………………………… }
function exforsys(x,y)
{
//Block of Code
…………………………………………
Suppose the values passed to the function from the calling program are 10 and 15.
Then, from the calling program the function is called as follows:
|
Next Page: Returning Values from Function
Comments
rasla said:
| The data is insufficient to find an answer |
vijaya said:
|
how to pass dynamic values to java script function e.g. in "disp_alert()" function i want to pass the value entered in textbox having id "txtName". |
john anderson said:
| Can you give an example of passing values from one class to the next? |
Sponsored Links
