I don't feel 50 Forums

Go Back   I don't feel 50 Forums > COMPUTERS > Web Design and Graphics Room.

Web Design and Graphics Room. Thread, CPS Help

Hello CPS, You have very kindly helped me in the past and wonder if I could call upon your services ...

Reply
 
LinkBack Thread Tools Display Modes
  #1  
Old 3rd-February-2005, 09:35 PM
tezzer's Avatar
tezzer tezzer is offline
 
Join Date: Sep 2002
Posts: 394
Default CPS Help

Hello CPS,

You have very kindly helped me in the past and wonder if I could call upon your services once again.
Do you have a code I could use to show the current date on my website.
I know you can put clocks up but is it possible with dates?

If you're busy it's not an urgent matter.

Regards,
Tezzer.
Reply With Quote
  #2  
Old 4th-February-2005, 01:45 AM
Skyrunner's Avatar
Skyrunner Skyrunner is offline
 
Join Date: Sep 2002
Location: The Surrey Hills
Posts: 1,202
Default

Hi tezzer

Yes, it's possible.

Stick this code in where you want the date to appear... (obviously you can change the colour etc if you want!)


<CENTER>
<FONT face="verdana, helvetica" color=navy
size=1>[b]
<SCRIPT language=JavaScript>

var months=new Array(13);
months[1]="January";
months[2]="February";
months[3]="March";
months[4]="April";
months[5]="May";
months[6]="June";
months[7]="July";
months[8]="August";
months[9]="September";
months[10]="October";
months[11]="November";
months[12]="December";
var time=new Date();
var lmonth=months[time.getMonth() + 1];
var date=time.getDate();
var year=time.getFullYear();
if (year<100) year="19" + time.getFullYear();
else year=time.getFullYear();

document.write("[b]<center>" + date + ", " +lmonth + " ");
document.write( year + "</center>");

</SCRIPT>
</CENTER>


Come back here if you have a problem... but it works for me! :wink:
Reply With Quote
  #3  
Old 4th-February-2005, 02:45 PM
CPS's Avatar
CPS CPS is offline
 
Join Date: Jan 2003
Location: Suffolk/ Gender Male
Posts: 1,444
Default

OK and here is another one to play with.
This is a digital clock with date and time.
Sky's looks nice for current date.

Code:
<HTML>
<HEAD>
<TITLE>CLOCKDIG</TITLE>
<BODY BGCOLOR="AQUA" TEXT="RED">

<! this is the standard HTM form and display method->

<form name="myForm" action="" method="SHOW">

<!Again the standard way to name the form ->

<input name="myClock" type="Text">

<!Here we dive into javascript ->

<script language=javascript>

//And here we set up an interval timer

self.setInterval('clock()',60)

//Now name a function and what it does

function clock() {
    time=new Date()
    document.myForm.myClock.value=time
}

//NOTE because time has not been nominated as a variable (var)
//it is only valid for thid function
//you cannot refer to it outside the funtion.

</script>
</form>
</HEAD>

<! Here we return to HTML.


<H3><CENTER>Here's where you put your text.


As usual, go to VIEW--SOURCE to see the coding.
</BODY>
</HTML>
__________________
Knowledge is not knowing all the answers,
but knowing where to find the answers.

www.smitheram.co.uk

Moderator of, Web Design/Graphics Room.
P4-XP pro-IE7-B/B-ZA-AVG
Reply With Quote
  #4  
Old 4th-February-2005, 03:23 PM
CPS's Avatar
CPS CPS is offline
 
Join Date: Jan 2003
Location: Suffolk/ Gender Male
Posts: 1,444
Default

Here is another one, just the date this time.
There are plenty of different one's on the web.


Code:
<!-- ONE STEP TO INSTALL BASIC DATE DISPLAY:

  1.  Copy the coding into the BODY of your HTML document  -->



<BODY>

<SCRIPT LANGUAGE="JavaScript">





<!-- Begin

// Get today's current date.
var now = new Date();

// Array list of days.
var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday',
'Friday','Saturday');

// Array list of months.
var months = new Array('January','February','March','April','May','June',
'July','August','September','October','November','December');

// Calculate the number of the current day in the week.
var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();

// Calculate four digit year.
function fourdigits(number)	{
	return (number < 1000) ? number + 1900 : number;
								}

// Join it all together
today =  days[now.getDay()] + ", " +
         months[now.getMonth()] + " " +
         date + ", " +
         (fourdigits(now.getYear())) ;

// Print out the data.
document.write(today);

//  End -->
</script>




<center>
<font face="arial, helvetica" size"-2">Free JavaScripts provided

by The JavaScript Source</font>
</center>
__________________
Knowledge is not knowing all the answers,
but knowing where to find the answers.

www.smitheram.co.uk

Moderator of, Web Design/Graphics Room.
P4-XP pro-IE7-B/B-ZA-AVG
Reply With Quote
  #5  
Old 4th-February-2005, 10:25 PM
tezzer's Avatar
tezzer tezzer is offline
 
Join Date: Sep 2002
Posts: 394
Default

Skyrunner and CPS,

Thank you so much for doing that for me.
I will be incorporating one of them when I next update my site.

Regards,
Tezzer.
Reply With Quote
  #6  
Old 5th-February-2005, 04:09 PM
CPS's Avatar
CPS CPS is offline
 
Join Date: Jan 2003
Location: Suffolk/ Gender Male
Posts: 1,444
Default

I liked the look of the one Sky posted but I wanted to have the day of the week included.
So have had a play about with it and added a bit of Sky's to one of the codes I posted.
Here it is, it gives Day, Date, Month, Year, change font color and size to your liking.

NOTE:- I have added it to my webpage if you want to see it.


Code:
<BODY>
<CENTER>
<FONT face="verdana, helvetica" color=navy
size=2>[b]

<SCRIPT LANGUAGE="JavaScript">





<!-- Begin

// Get today's current date.
var now = new Date();

// Array list of days.
var days = new Array('Sunday','Monday','Tuesday','Wednesday',
'Thursday','Friday','Saturday');

// Array list of months.
var months = new Array('January','February','March','April','May','June',
'July','August','September','October','November','December');

// Calculate the number of the current day in the week.
var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();

// Calculate four digit year.
function fourdigits(number)	{
	return (number < 1000) ? number + 1900 : number;
								}

// Join it all together
today =  days[now.getDay()] + ", " +
         months[now.getMonth()] + " " +
         date + ", " +
         (fourdigits(now.getYear())) ;

// Print out the data.
document.write(today);

//  End -->
</script>

</center>
__________________
Knowledge is not knowing all the answers,
but knowing where to find the answers.

www.smitheram.co.uk

Moderator of, Web Design/Graphics Room.
P4-XP pro-IE7-B/B-ZA-AVG
Reply With Quote
  #7  
Old 5th-February-2005, 06:41 PM
tezzer's Avatar
tezzer tezzer is offline
 
Join Date: Sep 2002
Posts: 394
Default

Hello CPS,

Thanks again for the help.
It must be me but I can't make out the difference in the two posts.
They both give the same results and I have studied the coding and they appear the same.
By the way is it normal for Internet Explorer to block the page when it includes the new code.
I find I have to click OK on the Information Bar and click again on the yellow bar on the top of the window to allow blocked content and again on the Security Warning box that pops up.
XP Pro SP2 IE6

Regards,
Tezzer.
Reply With Quote
  #8  
Old 5th-February-2005, 08:53 PM
CPS's Avatar
CPS CPS is offline
 
Join Date: Jan 2003
Location: Suffolk/ Gender Male
Posts: 1,444
Default

Yes Tezzer
Its only a small difference, I centered it and added the code to choose the font, size and color as per Sky's version.
The only visual difference between them is that the day of the week is shown in mine,
that's if you want the day of the week that is.
I don't know the reason for the problem you appear to have, I tested it in I.E. and FireFox worked fine in both.
One point that may cause a problem is this,
I had to wrap it to show the code on on IDF as it was doubling the screen width.
So make the code for the days and months one long line for each.

I see you are using XP, I just wonder if its a security thing, it does not like the code looking for the date and time on your PC to display.

A little tip
I have just looked at your site very nice.
You will notice that the text butts right up against the border.
Here is a quick and simple cure, for each paragraph of text add the BLOCKQOUTE TAG.
<blockqoute>
paragraph text
</blockqoute>
This will move your text away from your yellow border, try it.
__________________
Knowledge is not knowing all the answers,
but knowing where to find the answers.

www.smitheram.co.uk

Moderator of, Web Design/Graphics Room.
P4-XP pro-IE7-B/B-ZA-AVG
Reply With Quote
  #9  
Old 7th-February-2005, 09:42 PM
tezzer's Avatar
tezzer tezzer is offline
 
Join Date: Sep 2002
Posts: 394
Default

Hello CPS,

Thank you for looking at the site and your advice about the text butting up to the edge.
I have used the blockquote as you suggested and I've been playing around with the dates etc.
Would you kindly have a look HERE.
This is where I wanted the date to show, seeing as it worked in this one I have put a version in the other site as well.
Does the date work OK on your browser?
Both sites are based on IE and a screen resolution of 800x600.
By the way trouble about IE blocking the page was down to the security settings.

Regards,
Tezzer.
Reply With Quote
  #10  
Old 7th-February-2005, 10:42 PM
CPS's Avatar
CPS CPS is offline
 
Join Date: Jan 2003
Location: Suffolk/ Gender Male
Posts: 1,444
Default

Ok looks fine on IE except on About Poptical page 1, for some reason the blue poptical on the left is not showing, But I can see it on FireFox.
I have not had a good look yet but I believe its the Blockqoute affecting that particular page only.
In IE the borders are fine in Firefox no change.
Blue Poptical visible in FireFox not in IE.
With out looking you may need a table, one row by two colums.
First colum to take blue Poptical the second to take the text.
Its to late to go into detail now will post again tomorrow.

Clock shows OK on the other site also.
__________________
Knowledge is not knowing all the answers,
but knowing where to find the answers.

www.smitheram.co.uk

Moderator of, Web Design/Graphics Room.
P4-XP pro-IE7-B/B-ZA-AVG
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 06:48 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.