Java script

  • Thread starter Thread starter Jane Here
  • Start date Start date
J

Jane Here

I'd like to have some Java script on my front page to show the date.
However, I don't want visitors who don't have Java to get an error.

Is this possible?
 
Don't confuse Java with javascript. They are only as similar as fish and
bicycles.

If the browser doesn't have javascript enabled, you will not get an error.
You can get this script and examine its operation on my site -
http://www.great-web-sights.com (look at the code on the page).
 
Try this:

<script>document.write(new Date())</script>

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
 
Java applets - are compiled programs.
javascript - is inserted into html documents and is in "plain" english.

Similar in name only not nature, and even that is a *coincidence*

To avoid the error for non Javascript users

Something to do with <noscript> tags. but visit the site suggested in the reply
below, you will probably find what you want.
 
That's neat<g>.
It add some stuff after the date itself. Is that easily removed?
(If not, I can use a script supplied by another user).


How can I disable the running of Java scripts in IE? I would like to do that
to see what a user gets when he comes to a page with this Java script on it.

Thanks.
 
OIC.
Many thanks for clearing that up.


Andrew Murray said:
Java applets - are compiled programs.
javascript - is inserted into html documents and is in "plain" english.

Similar in name only not nature, and even that is a *coincidence*

To avoid the error for non Javascript users

Something to do with <noscript> tags. but visit the site suggested in the reply
below, you will probably find what you want.
 
Put this in the head of the page -

<script language="JavaScript" type="text/javascript">
function getTheDate() {
var now = new Date();
// d =
["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][now.getDay()]+",
";
d =
["Jan.","Feb.","Mar.","Apr.","May","June",
"July","Aug.","Sept.","Oct.","Nov.","Dec."][now.getMonth()]+" ";
d+=now.getDate()+", "+now.getFullYear();
return d;
}
</script>

and in the body, put this -

<script language="JavaScript"
type="text/javascript">document.write(getTheDate());</script>
 
Hi Andrew,

Just a couple of notes:

JavaScript is in plain "text" - not plain "english".

They are similar in name not by coincidence, but for the same reason that VB
and VBScript are similar in name. The language syntax is based upon Java
syntax. JavaScript is a scaled-down scripted Java, in essence.

--
HTH,
Kevin Spencer
..Net Developer
Microsoft MVP
I get paid good money to
solve puzzles for a living
 
OK, then try this:

<script>
d = new Date();
document.write((d.getMonth() + 1) + "/" + d.getDate() + "/" + d.getYear());
</script>

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------
 
Thanks, does the job.

Jim Buyens said:
OK, then try this:

<script>
d = new Date();
document.write((d.getMonth() + 1) + "/" + d.getDate() + "/" + d.getYear());
</script>

Jim Buyens
Microsoft FrontPage MVP
http://www.interlacken.com
Author of:
*----------------------------------------------------
|\---------------------------------------------------
|| Microsoft Office FrontPage 2003 Inside Out
||---------------------------------------------------
|| Web Database Development Step by Step .NET Edition
|| Microsoft FrontPage Version 2002 Inside Out
|| Faster Smarter Beginning Programming
|| (All from Microsoft Press)
|/---------------------------------------------------
*----------------------------------------------------

"Jane Here" <[email protected]> wrote in message
 
I see what you are doing - thanks for the info.

Murray said:
Put this in the head of the page -

<script language="JavaScript" type="text/javascript">
function getTheDate() {
var now = new Date();
// d =
["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][now
..getDay()]+",
";
d =
["Jan.","Feb.","Mar.","Apr.","May","June",
"July","Aug.","Sept.","Oct.","Nov.","Dec."][now.getMonth()]+" ";
d+=now.getDate()+", "+now.getFullYear();
return d;
}
</script>

and in the body, put this -

<script language="JavaScript"
type="text/javascript">document.write(getTheDate());</script>

--
Murray

Jane Here said:
OIC.
Many thanks for clearing that up.
 
You are welcome!

--
Murray

Jane Here said:
I see what you are doing - thanks for the info.

Murray said:
Put this in the head of the page -

<script language="JavaScript" type="text/javascript">
function getTheDate() {
var now = new Date();
// d =
["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"][now
.getDay()]+",
";
d =
["Jan.","Feb.","Mar.","Apr.","May","June",
"July","Aug.","Sept.","Oct.","Nov.","Dec."][now.getMonth()]+" ";
d+=now.getDate()+", "+now.getFullYear();
return d;
}
</script>

and in the body, put this -

<script language="JavaScript"
type="text/javascript">document.write(getTheDate());</script>

--
Murray

Jane Here said:
OIC.
Many thanks for clearing that up.


Java applets - are compiled programs.
javascript - is inserted into html documents and is in "plain"
english.

Similar in name only not nature, and even that is a *coincidence*

To avoid the error for non Javascript users

Something to do with <noscript> tags. but visit the site suggested in
the
reply
below, you will probably find what you want.

Don't confuse Java with javascript. They are only as similar as
fish
and
bicycles.

If the browser doesn't have javascript enabled, you will not get an
error.
You can get this script and examine its operation on my site -
http://www.great-web-sights.com (look at the code on the page).

--
Murray

I'd like to have some Java script on my front page to show the date.
However, I don't want visitors who don't have Java to get an
error.

Is this possible?
 
Back
Top