Social Icons

Pages

How to Display Current Date & Time

<!DOCTYPE html>
<html>
<head>
<script>
function displayDate()
{
document.getElementById("demo").innerHTML=Date();
}
</script>
</head>
<body>

<h1>
Today's date is</h1>
<p id="demo">
</p>

<button type="button" onclick="displayDate()">Display Date</button>

</body>
</html>

How to display Current Date & Time








Today's date is






How to remove the default text in textbox when clicked on it

<html><head><title>(Type a title for your page here)</title>

  <script type="text/javascript">
  function make_blank()
  {
  document.form1.type.value ="";
  }
  </script>

  </head>
  <body >

  <form name=form1 method=post action='test.php'>
  <input type=text name=type value='Enter your user id' onClick="make_blank();"></form>

  </body>
  </html>

C program Code to shutdown,restart,logoff,hibernate the computer

  1. #include <stdlib.h>
  2. #include <stdio.h>
  3. #include<conio.h>
  4. void main()
  5. {
  6. int ch;
  7. clrscr();
  8. printf("\n\n~~~~~~~~~~~~~~~~~SHUTDOWN MENU~~~~~~~~~~~~~~~~~~~\n");
  9. printf("1.Shutdown\n2.Restart\n3.Logoff\n4.Hibernate\n5.exit");
  10. printf("\nEnter choice : ");
  11. scanf("%d",&ch);
  12. switch(ch)
  13. {
  14. case 1:system("shutdown -s");
  15. break;
  16. case 2:system("shutdown -r");
  17. break;
  18. case 3:system("shutdown -l");
  19. break;
  20. case 4:system("shutdown -h");
  21. break;
  22. case 5:exit(1);
  23. break;
  24. default:printf("Invalid choice");
  25. }
  26. getch();
  27. }

Code to shutdown the computer using C Program

#include <stdio.h>
#include <stdlib.h>
  
main()
{
   char ch;
  
   printf("Do you want to shutdown your computer now (y/n)\n");
   scanf("%c",&ch);
  
   if (ch == 'y' || ch == 'Y')
      system("C:\\WINDOWS\\System32\\shutdown -s");
  
   return 0;
}
JAVA EXample to GeT the Greetings

<!DOCTYPE html>
<html>
<body>

<p>Click the button to get a greeting.</p>

<button onclick="myFunction()">Try it</button>

<p id="demo"></p>

<script>
function myFunction()
{
var x="";
var time=new Date().getHours();
if (time<12)
  {
  x="Good day";
  }
else if (time<16)
 {
 x="Good afternoon";
 }
else if (time<19)
 {
 x="Good evening";
 }
else
 {
 x="Good night"
 }
document.getElementById("demo").innerHTML=x;
}
</script>

</body>
</html>






Click the button to get a greeting.