Website background based on time of day. [Adobe Muse]

The code work great but isn’t fit on screen, can someone edit? (NB I make my website on adobe muse )

<html>
  <body>
   <script type="text/javascript">
var now = new Date();
var today = now.getDay();
var startTime = new Date();
startTime.setHours(08);
startTime.setMinutes(23);
startTime.setSeconds(00);
var endTime = new Date();
endTime.setHours(14);
endTime.setMinutes(43);
endTime.setSeconds(00);

if (today > 0 && today < 6)
    {
    if (startTime < now && endTime > now)
        {document.write('<img src="image2.jpg">');}
    else
        {document.write('<img src="image1.jpg">');}
    }
else
    {document.write('<img src="image1.jpg">');}
  </script>
 </body>
</html>

What size are your images?

If it’s a background image, it really should be applied to an element as a background-image.
Either way, the size it will appear at can be defined by css.
An image element with no size attributes and no css applied will be the size the image is, be that greater or smaller than any given screen.
Though it’s not clear how you intend the place and size the image, I can only assume you want a full-screen body background.

1280 x 700

maybe the problem came from document.write ?

You really should not be using “document.write()” and
“Adobe Muse” is a very poor choice for web delopment. :rolleyes:

Use something like “document.getElementById()” or
“document.queryselector()” instead, and something
similar to “Notepad++” or “Sublime Text” as possible
text editor alternatives. :winky:

coothead

There is a software without codes better then adobe muse I can use ?

sintex150,

Why are you here? Why are you visiting us?

Is it because you have started writing a web page using a product that promises “no code” web pages and you want to make a simple change to the way the page looks but do not have the faintest idea how to change the code to make the page look the way you wish?

One cannot realistically write a decent web page without having a working knowledge of HTML and CSS code. The promise of designing a web page without code only goes as far as the design limits of the product (Adobe Muse, in this case) permit.

Learning HMTL and CSS isn’t that hard. It takes time and practice to learn how the elements and properties behave and interact, but that’s fun.

Take the time to learn to write HTML and CSS, and add JavaScript as needed. If you will do that for yourself, you will not be hamstrung by some framework or proprietary product that does not fill your future needs (or even fill your most basic needs right now).

If you do not wish to invest in yourself, then Adobe offers instructions, tutorials, and a user community where you can receive help using their product.

3 Likes

Thank you for your advice!

The problem is this:-

and this:-

If the screen is any smaller than that image size, it simply will not fit on the screen.

However this can be remedied vis CSS.
But to give a specific answer, we need to know the specific desired result.

2 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.