Javascript Part 22.2: Creating Functions
<html>
<head>
<title>Javascript Project</title>
<script>
Function myFun() {
pmt= prompt('Enter your name','');
document.write(' pmt ');
}
</script>
</head>
<body>
<button onclick="myFun();">Click here to add your name</button>
</body>
</html>
Javascript Part 23: Creating Functions with Multi Parameters
<html>
<head>
<title>Javascript Project</title>
<script>
Function myFun(x,y) {
document.write(' Hello Friends My name is '+x, +y);
}
myFun('Devika', 'Mast');
myFun('Geetika', 'Town');
</script>
</head>
<body>
</body>
</html>
Javascript Part 24: Return Functions
<html>
<head>
<title>Javascript Project</title>
<script>
Function myFun() {
return 'getting return';
}
myFun();
document.write('getting return');
alert(myFun());
</script>
</head>
<body>
</body>
</html>
Javascript Part 25: Cal Function
<html>
<head>
<title>Javascript Project</title>
<script>
Function calc(x,y) {
z=x*y
return z;
}
alert(calc(5,6));
</script>
</head>
<body>
</body>
</html>
Javascript Part 27: Creating Functions Local & Global variable
<html>
<head>
<title>Javascript Project</title>
<script>
Function myFunction() {
x= 'www.socialjersey.com'
document.write(' This is domain ' +x);
}
myFunction();
</script>
</head>
<body>
</body>
</html>