Welcome to Dream.In.Code
Getting Help is Easy!

Join 109,560 Programmers for FREE! Ask your question and get quick answers from experts. There are 1,370 online right now! We've got more than 500 tutorials and 2,000 snippets. Join and find out why Dream.In.Code is the #1 programming help community on the internet! Registration is fast and FREE... Join Now!



page not displaying jpg pictures

 
Reply to this topicStart new topic

page not displaying jpg pictures, page isn't displaying pics

shawnr72
post 29 Jul, 2008 - 11:23 AM
Post #1


New D.I.C Head

*
Joined: 29 Jul, 2008
Posts: 1

Hello;

First let me start with that I have not done any scripting in a few years, until i landed this job, my first task was to upgrade the company's website, so I thought it would be great to have the head of the site change according to time of day. Well I can't get the page to display anything. I have an external CSS for the formatting of the headings and the body, but nothing display at all. blink.gif So i was wondering if someone could lead me in the right direction I will post both the CSS and javascript, although i think the css is right
CODE

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="STYLESHEET" href="New.css" type="text/css"/>

<script language = "javascript">
day=new Date();     //..get the date

hours=day.getHours();    //..get the hour

if(hours>=0 && hours<5)
{
    document.write('<img src="night.JPG" width="800" height="600" alt="" border="0">');
}

else

if(hours>=5 && hours<7)
{
    document.write("<img src="sunrise2 (2).jpg" width="120" height="90" alt="" border="0">");
}

else

if(hours>=7 && hours<12)
{
    document.write("<img src= "morning2.jpg"  width= "800" height="534" alt="" border='0'>");         
}

else

if(hours>=12 && hours<16)
{
    //document.write('<img src="afternoon.jpg" width='300' height='150' border='5'>');
    alert("hello");
}

else

if(hours>=16 && hours<20)
{
    document.write('<img src="evening.jpg" width="120" height="90" alt="" border="0">');
    alert("this is a test");
}

else

if (hours>=20 && hours<24)
{
document.write('<img src="night.JPG" width="800" height="600" alt="" border="0">');
alert("hello");
}

and here is the CSS
CODE

body {
background-color: #FFFFF0;
font-family: Arial, Verdana, sans-serif;
font-size: 18px;
color: #00008B;
}

a { font-family: Arial, Verdana, sans-serif; font-size: 18px; color: #483D8B; text-decoration: underline}

a:hover { font-family: Arial, Verdana, sans-serif; font-size: 18px; color: #A52A2A; background-color: #FAEBD7}

h1 { font-family: Arial, Verdana, sans-serif; font-size: 32px; color: #A52A2A }
h2 { font-family: Arial, Verdana, sans-serif; font-size: 24px; color: #A52A2A }

hr{ color:brown; background-color:tan; width:90%; height:2px; }

table {
font-family: Arial, Verdana, sans-serif;
font-size: 18px;
color: #00008B;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
margin-left: 0px;
padding-top: 0px;
padding-right: 0px;
padding-bottom: 0px;
padding-left: 0px;
}

.note {
font-family: Arial, Verdana, sans-serif;
font-size: 14px;
color: purple;
font-weight: bold;
}


This post has been edited by shawnr72: 29 Jul, 2008 - 11:34 AM
User is offlineProfile CardPM

Go to the top of the page


BetaWar
post 29 Jul, 2008 - 12:49 PM
Post #2


#include <soul.h>

Group Icon
Joined: 7 Sep, 2006
Posts: 1,266



Thanked 38 times

Dream Kudos: 775
My Contributions


You need to make sure that you are using the same type of quotes for everything so that it doesn't get confused.

Here this seems to be working now:

CODE
<script>day=new Date();     //..get the date

hours=day.getHours();    //..get the hour

if(hours>=0 && hours<5){
    document.write('<img src="night.JPG" width="800" height="600" alt="" border="0">');
}
else if(hours>=5 && hours<7) {
    document.write('<img src="sunrise2 (2).jpg" width="120" height="90" alt="" border="0">');
}

else if(hours>=7 && hours<12) {
    document.write('<img src= "morning2.jpg"  width="800" height="534" alt="" border="0">');        
}
else if(hours>=12 && hours<16) {
    document.write('<img src="afternoon.jpg" width="300" height="150" border="5">');
}
else if(hours>=16 && hours<20) {
    document.write('<img src="evening.jpg" width="120" height="90" alt="" border="0">');
}
else if (hours>=20 && hours<24) {
document.write('<img src="night.JPG" width="800" height="600" alt="" border="0">');
}
</script>


Hope that helps.
User is offlineProfile CardPM

Go to the top of the page

Fast ReplyReply to this topicStart new topic
Time is now: 9/7/08 11:18PM

Live Help!

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

Bye Bye Ads

Free DIC T-Shirt

T-Shirt Example

Related Sites

Monthly Drawing

Thumb Drive

Partners

Top Contributors

Top 10 Kudos This Month