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

  • Home
  • SEARCH
  • 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 6649929
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T00:49:57+00:00 2026-05-26T00:49:57+00:00

im trying to write a little .js file to change a css style from

  • 0

im trying to write a little .js file to change a css style from display:block to display:none depending on the time of day, 08.30 to 17.00 display block and 17.00 to 08.30 display none.

Here’s what i have so far:

<script language="JavaScript">
day=new Date()     //..get the date
x=day.getHours()    //..get the hour

if(x>=8.30 && x<17) {

  document.write('<style type="text/css">#live{display:block}"></style>')

 } else

 if(x>=17 && x<8.30) {

   document.write('<style type="text/css">#live{display:none}"></style>')

};

</script>

Do think this is good js plus not sure if using 8.30 would work plus not sure if the last “;” is needed.

Any help on this would be great thanks.

Im now trying this code but does not work

<script type="text/javascript">
$(document).ready ( function (){

var dateObj = new Date();
var hour = dateObj.getHours() * 100 + dateObj.getMinutes();

if (hour >= 1600 && hour <= 1800) {
document.getElementById('live').style.display = "none";
 }


 });

 </script>
  • 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-26T00:49:58+00:00Added an answer on May 26, 2026 at 12:49 am
    1. getHours() returns a whole number (0 to 23). For 8:30, you will
      need to check getHours() and getMinutes() accordingly.
    2. The last semicolon does not need to be there.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to write a little C# program that reads from a text file
I'm trying to write a little Emacs Lisp script that reads a csv file
I've got this little batch file I'm trying to write for a Windows 7
i´m trying to write a little script for writting a sqlite table from an
Hey guys, just another little problem here! Trying to write a quiz for a
I'm trying to write a little helper for Windows which eventually will accept a
I'm trying to write a quick little java application to read the contents of
I'm trying to write a simple Resource Manager for the little hobby game I'm
This is going to be a little tricky to explain. I'm trying to write
Trying to write a couple of functions that will encrypt or decrypt a file

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.