Beginner with Java

Greetings To All
===========

I have copied a java script to my FP web page. It is supposed to show today's date. It does not increment. I obviously need something else.

Where can I learn "First Steps With Java"?

Thanks,

robinski
robinskiAsked:
Who is Participating?
 
cbasic100798Connect With a Mentor Commented:
Hi robinski,

Here's one that I use.
You can put this anywhere in your HTML page.

<html>
<body>
<script>
<!--  
// Today's Date
var now = new Date();
var mName = now.getMonth() + 1;
var dName = now.getDate();
var yName = now.getYear();

// String to display current date.
var todaysDate =(" "
+ mName
+ "/"
+ dName
+ "/"
+ yName);

// Write date to page.
document.write("<font face=Verdana,Arial,Helvetica size=2 color=000000><strong>"+todaysDate+"</strong></font>");
//  -->
</script>
</body>
</html>


Go to www.cbasic.com to see it in action.

Enjoy
Clyde
0
 
cbasic100798Commented:
Sorry I missed the other part of your Q.
This is a good place to start looking for a book on JavaScript.

http://www.wrox.com/Consumer/Store/ListTitles.asp?By=105&Category=Consumer
Clyde
0
 
robinskiAuthor Commented:
cdbasic,

Thanks. I tried and I get the error message:

Line 32
Char 80
Unterminated string comstant.

The page with my attempt is at:

www.vicnet.net.au/~ri9790/clubs/dcreek/

This does not give an erro message but also does not work.

Cheers

robinski
0
Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

 
cbasic100798Commented:
What is the link to the page that has the code I provided?

Clyde
0
 
robinskiAuthor Commented:
I have only run that on my PWS server
0
 
robinskiAuthor Commented:
0
 
cbasic100798Commented:
Well now this might be more like the format you are looking for.


<SCRIPT LANGUAGE="Javascript">
<!--
// Array of day names
var dayNames = new Array( "Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
// Array of month Names
var monthNames = new Array( "January","February","March","April","May","June","July","August","September","October","November","December");
var now = new Date();
document.write(dayNames[now.getDay()] + ", " + monthNames[now.getMonth()] + " " + now.getDate() + ", 19" + now.getYear());
// -->
</SCRIPT>

I did a local test OK.
Enjoy
Clyde
0
 
robinskiAuthor Commented:
Clyde,

Yes that is better. Many thanks.

What was wrong with the original?

robinski.
0
 
cbasic100798Commented:
I don't know it works on my site OK.
Maybe the ghost of christmas past. ;>)

Enjoy the day,
Clyde
0
 
robinskiAuthor Commented:
Greetings To All
===========

Your code worked until the year end. Now it does not translate the year correctly.

I can edit the script in FP2000 and the preview shows correctly but does not display from the web.

Should I make this another question?

robinski
0
 
cbasic100798Commented:
Howdy robinski,
Send the URL so I can look at the source.

Clyde
0
 
robinskiAuthor Commented:
Greetings Clyde,

The code is yours from above.

This one has the original:

http://www.vicnet.net.au/~ri9790/clubs/kilmore/

and I have cheated with this one:

http://www.vicnet.net.au/~iwda61/

Thanks for your help and best wishes for the final year of the 20th century

robinski
0
 
cbasic100798Commented:
Howdy,
This is what I see on your page.
"Last Updated      Saturday, January 1, 192000 "

This is your source
document.write(dayNames[now.getDay()] + ", " + monthNames[now.getMonth()] + " " + now.getDate() + ", 19" + now.getYear());

Get rid of the *19* and remove the line break between the *19* and the *+* that should take care of it.

This is how the line should look.
document.write(dayNames[now.getDay()] + ", " + monthNames[now.getMonth()] + " " + now.getDate() + ", " + now.getYear());

Enjoy,
Clyde
0
 
robinskiAuthor Commented:
Clyde,

I tried this on:

http://www.vicnet.net.au/~ri9790/

Year now shows as 100.

Oh dear! <G>

robinski
0
 
cbasic100798Commented:
Must be the Y2K bug on your end. ;>)
This is what I see.
Last xx Updated      Sunday, January 2, 2000

Go here http://www.cbasic.com/tips/date.htm & let me know what you see.
I copy/pasted your code to this page.

Clyde
0
 
cbasic100798Commented:
BTW,
This script runs on the client side. So it is dependent upon the clients system date. Check your system date. What does it say? Are you Y2K compliant? ;>)

Clyde
0
 
robinskiAuthor Commented:
Clyde,

Yes I am compliant. My FP editor shows 2000 and your page shows:

Date Test
                                       Monday, January 3, 100


The provider is our State government. We get free space as a community service group.

I also notice that the file date on my FTP client is:

1000103

Is this the culprit?

robinski
0
 
cbasic100798Commented:
Well Robin,
Sure looks like it. Have a friend from another ISP take a look at your page and find out what they see.

Welcome to computing. ;>)
Clyde
0
 
cbasic100798Commented:
Robin,
I just view your page from a different ISP and the date is being displayed correctly.

Enjoy,
Clyde
0
 
robinskiAuthor Commented:
Clyde,

Did you check the code?

I have added a fixed 2000 over a period of a few hours to most of the site.

I have not yet touched the PRPapers directory so this URL is showing "100" with me.

http://www.vicnet.net.au/~ri9790/district/prpapers/GSEgen.htm

Thanks for taking the interest.

robinski
0
 
cbasic100798Commented:
Did you have a friend from another ISP view the page?
The code is correct, The way it's being displayed at your end is the problem. JavaScripts are client/browser dependent.

Take care and best wishes,
Clyde
0
All Courses

From novice to tech pro — start learning today.