Web Technologies

Web Technologies 

Slip30

Q.1) Write a JavaScript program to Display current Day, Date, Month, Year and Time on the web page and greet the user accordingly.  [Marks30] 

Solution
a.html
<html>
<head>
<script language="javascript">
var a=new Date();
document.writeln("current day="+ a.getDay());
document.writeln("<br>today date="+ a.getDate());
document.writeln("<br>current month="+ a.getMonth());
document.writeln("<br>current year="+ a.getYear());
document.writeln("<br>current time="+ a.getHours() + ":" + a.getMinutes()+ ":" + a.getSeconds());

if(a.getHours()<12)
{
document.writeln("<br> Good Morning");
}
else if(a.getHours()>12 && a.getHours()<16)
{
document.writeln("<br>Good Afternoon");
}
else if(a.getHours()>16 && a.getHours()<20)
{
document.writeln("<br>Good Evening");
}
else
{
document.writeln("<br>Good Night");
}

</script>
</head>
</html>

BCA Pratical Solution

My name is Vivek And I from Mumbai and Complete my Graduation Bca.my Age is 23 Years.

Post a Comment

Previous Post Next Post

DBMS Practical Slips