Monday, 23 May 2011

Learn PHP online : PHP Day-35

Function Pre Defined Function User Defined Function in Java Script

                                        

JavaScript : Function Pre Defined Function User Defined Function

Sample JavaScript


<head>

<script type="text/javascript" language="javascript">
alert("welcome")
</script>
</head>

Sample Java Script 2
<head>
<input type="button" value="click" onClick='alert("Button Clicked")'>
</head>

Function: Function is an set of executable statements and functions we are using for reasonability’s. Function divided into two parts.
*Pre Defined Function: This functions are nothing but building function which are available with languages. Ex: alert, presInt, evil
*User Defined Function: Functions defined by the programmers at the time of application development. By using this function keyword we can declare the functions. The syntax of function declaration is ..
Function<name>()
{
//Java Script Statement
}
SAMPLE JAVA SCRIPT 2
<script>
function fun1()
{
alert("PHP NOTES SCRIPT")
}
</script>
<input type="button" value="click" onClick="fun1()">

SAMPLE JAVA SCRIPT 3
<script>
function fun1(x,y)
{
alert(x+y)
}
</script>
<input type="button" value="click" onClick="fun1(10,20)">

SAMPLE JAVA SCRIPT 3
<script>
fonction fun1()
{
rval=fun2()
alert("rval")
}
function fun2()
{
x=100;y=200;k=x+y;return k
}
</script>
<input type="button" value="click" onClick="fun1()">

No comments:

Post a Comment

Visual comparison of the two methods, creating a simple table.

Option 1, using PHP: // PHP $html = '<table>' ;     foreach ( $data as $row ) {     $html .= '<tr>...