Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7091243
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:09:37+00:00 2026-05-28T08:09:37+00:00

This is my full code of month calender. It also show time on today’s

  • 0

This is my full code of month calender. It also show time on today’s date. The gettime function return the current time, but the time is static. To make the time dynamic what should I do?

<html>
<head>
<script type="text/javascript">
function gettime()
 {
  var time=new Date()
  var hour=time.getHours()
  var minute=time.getMinutes()
  var text=hour+':'+ minute
  return text
  }
function nameofmonth(month)
 {
   var monthname=new Array("January","February","March","April","May","June","July","August","September","October","November","December")
   return monthname[month]
   }
 function monthdays(month,year)
  {
    var daysofmonth=new Array(31,28,31,31,30,31,31,31,30,31,30,31)
     if(year%4==0)
       daysofmonth[1]=29  
         return daysofmonth[month]   
     }

 function table()
   {
     var now=new Date()
     var hour=now.getHours()
     var minute=now.getMinutes()
     var second=now.getSeconds()

     var date=now.getDate()
     var month=now.getMonth() 
     var year=now.getFullYear()
     now.setFullYear(year,month,1)
     var firstday=now.getDay()
     var monthname=nameofmonth(month)
     var daysofmonth=monthdays(month,year)
     if(firstday>0)
          var k=-(firstday-1)
     else
           k=1
      var table="<table border=5 cellspacing=9 cellpadding=13>"
      table +="<th colspan=7>"+monthname+" "+date+"th</th>"
      table +="<tr><th>sun</th><th>mon</th><th>tue</><th>wed</th><th>thu</th<th>fri</th><th>sat</th></tr>"
     for(var i=0;i<5;i++)
        {
          table+="<tr>"
          for(var j=0;j<7;j++)
           {
             if(k<=daysofmonth && k>0)
               { if(k==date)
                  table+='<td bgcolor="aqua">'+k+'<br>'+gettime()+ '</td>'
                  else
                   table+='<td>'+k+'</td>'
               k=parseInt(k)

             } 
            else
               table+="<td></td>"
             k++
        }
      table+="</tr>"
      }
     table+="</table>"
    document.write(table)
      }      
</script>
</head>
<body onload="table()">
</body >
</html>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T08:09:38+00:00Added an answer on May 28, 2026 at 8:09 am

    Add <div id='clock'></div> to the document. In table() replace document.write with

     document.getElementById("clock").innerHTML = table
    

    Write a separate onload function, in this function use setInterval to call table() periodically.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I tried to do it this: $(this + ' li:not(:nth-last-child(2)):not(:last-child)').hide() Full code sample: $('.comments').each(function(){
so basically, please check this code - Full code - <script type=text/javascript> $(document).ready(function() {
Ho to make this simple xml with php using DOM? Full code will be
Full disclosure: this is for an assignment, so please don't post actual code solutions!
How i can get full right name of generic type? For example: This code
And set the 'height' 1/2 of full screen. This is my code: <!DOCTYPE html
I want obtain full URL adres in php script, tell please, this code always
require 'coderay' puts CodeRay.scan('puts Hello, world!', :ruby).page This code will print full HTML page
Why does: DateTime.Now.ToString(M) not return the month number? Instead it returns the full month
I sunk about a month of full time into a native C++ equation parser.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.