Syntax :
function functionname()
{
some code to be executed
}
A function is written as a code block (inside curly { } braces), preceded by the function keyword
Simple example :
![]() |
| Output |
<html>
<body>
<p>Click the button to call a function with arguments</p>
<button onclick="myFunction('Steve','M')">Try it</button>
<script>
function myFunction(name,job)
{
alert("Hi "+ name + "," + "welocme");
}
</script>
</body>
</html>

No comments:
Post a Comment