Javascripts function syntax

by Ranganathan 2012-08-29 21:58:47

<font size=4>Javascripts function syntax </font>

javascripts function:

syntax:

function functionName(parameter_1, parameter_2, .. parameter_n){
statement1
statement2
statementn
}
Example:

'<HTML>
<HEAD>
<TITLE></TITLE>
<SCRIPT Language="JavaScript">
<!--

function getMax(n1, n2){
if (n1 < n2)
return n2
else
return n1
}

// -->
</SCRIPT>
</HEAD>

<BODY>
<SCRIPT Language="JavaScript">
<!--

document.write("<P>")
document.write("The largest number of 5 or 6 is: " + getMax(5, 6))
document.write("</P>")

// -->
</SCRIPT>
</BODY>
</HTML>'
786
like
0
dislike
0
mail
flag

You must LOGIN to add comments