Here in this asp.net example we will learn java script if statement in javascript exmaple we will leran java script function on button click event.
Here we tack an example of IF statement of Javascript.
Javascript code will be written in <Head> section of HTML page.
write the below javascript code at head section on web form:
<html><head>
<script type=”text/javascript”>
function show()
{
var mm = new Date();
var hour = mm.getHours();if (hour < 12)
{
alert (“Good morning”);
}
else
{
alert (“Very Good Afternoon”);
}
}</script>
</head>
Write below code at designing part of asp.net web forms.
<html><body>
<input type=”button” onclick=”show()” value=”If Statment” />
</body>
</html>
I hope this javascript if statement example will help you….