google.com, pub-4617457846989927, DIRECT, f08c47fec0942fa0 Learn to enjoy every minute of your life.Only I can change my life.: JavaScript

JavaScript


Your browser does not support the HTML5 canvas tag.

Example1.html :-

<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
function Hello()
{
alert("Hello,Welcome and  have a good day.");
}
</SCRIPT>
</HEAD>
<BODY>
<INPUT TYPE="button" NAME="Button" VALUE="Press me" onClick="Hello()">
</BODY>
</HTML>

Output :-




Example2.html :-


<HTML>
<HEAD>
<SCRIPT LANGUAGE="JavaScript">
function Name()
    {
        var answer = prompt("What is your name?", "");
        if (answer)
        alert("God bless You, " + answer);
    }
</SCRIPT>
</HEAD>
<BODY>
<INPUT TYPE="button" NAME="Button" VALUE="Press me" onClick="Name() ">
</BODY>
</HTML>

Output:-




Example3.html:-

<html>
<body>
<p>This example calls a function which performs a calculation, and returns the result:</p>
<script>
function myFunction(a,b)
{
return a*b;
}
document.write(myFunction(7,8));
</script>
</body>
</html>

Output:-
This example calls a function which performs a calculation, and returns the result:
 12



Example4.html:-
<html>
<body>
<script language="JavaScript">
function confirmFunction()
{
var a;
var b=confirm("You have press a button!Do you want to continue?");
if (b==true)
  {
  a="You have pressed OK to continue!";
  }
else
  {
  a="You have pressed Cancel to go back!";
  }
document.write(a);
}
</script>
<p>Example of Confirm box.Click the button below to display a confirm box.</p>
<button onclick="confirmFunction()">Press Me</button>
</body>
</html>

Output:-
Example of Confirm box.Click the button below to display a confirm box.



Exampe5.html :-
<html>
<body>
<p>Click the button to demonstrate the prompt box.</p>
<button onclick="promptFunction()">Press Me</button>
<script>
function promptFunction()
{
var a;
var b=prompt("Please enter your name","");
if (b!=null)
  {
  a="Hello " + b+ "! How are you today?";
  document.write(a);
  }
}
</script>
</body>
</html>

Output :-
Click the button to demonstrate the prompt box.




Example6.html :-
<html>
<body>
<p> Click the button to wait 3 seconds then greets alert "Welcome"</p>
<script language="JavaScript">
function TimeFunction()
{
setTimeout(function(){alert("Welcome to professional-in-computer.blogspot.com")},3000);
}
</script>
<button onClick="TimeFunction()">Press me</button>
</body>
</html>

Output :-
Click the button to wait 3 seconds then greets alert "Welcome"




No comments:

Post a Comment

शिव भोलेनाथ स्तुति

 जय शिवशंकर, जय गंगाधर, करुणा-कर करतार हरे,   जय कैलाशी, जय अविनाशी, सुखराशि, सुख-सार हरे जय शशि-शेखर, जय डमरू-धर जय-जय प्रेमागार हरे,   जय ...