Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Simple Ajax question.

1 view
Skip to first unread message

Mike Duffy

unread,
Dec 22, 2009, 9:34:02 PM12/22/09
to
After reading up a bit on Ajax, decided to try out a simple test script.
It works with IE (8), but not FF (3.5.3). I might add support for other
browsers later using the try..catch techniques that are well-documented
elsewhere, but that would be pointless to try when I cannot correctly
write the absolute simplest example I could think of, which was to take
the jibbering example and then change it to point to my own server.

In effect, I was looking for a script to tell me the server time, because
their clock is always several minutes slow and I need to know how many
minutes I need to wait after uploading a file before my new documents get
treated as being more recent than the ones in the various server cache
proxies.

When I run it with FF, it does not look like the callback is ever
executed. It just sits there. I have looked at dozens of ajax tutorial
sites, and they all boil down to the following code when you take away
the support for old browsers.

And I am using the index page of my website as the Ajax target, because
if I use a 3rd party site, IE gives me the warning about mixing secure /
insecure items.

<html lang="en">
<head>
<title>Test Server Time</title>

</head>

<body onLoad="test()">

<script type="text/javascript">
function test() {
var xmlhttp = new XMLHttpRequest();

xmlhttp.open("HEAD", "http://pages.videotron.com/duffym/index.htm",
false);

xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
document.write('Time at server: ' + xmlhttp.getResponseHeader('Date'))
};

}
xmlhttp.send(null);
}
</script>

</body>
</html>

David Mark

unread,
Dec 22, 2009, 9:44:19 PM12/22/09
to

Synchronous requests are always a bad idea.

https://developer.mozilla.org/en/XmlHttpRequest#open%28%29

>
>  xmlhttp.onreadystatechange=function() {
>   if (xmlhttp.readyState==4) {
>    document.write('Time at server: ' + xmlhttp.getResponseHeader('Date'))

Calling document.write on load is also a bad idea as it will wipe out
the previously loaded document.

>   };
>
>  }
>  xmlhttp.send(null);}
>
> </script>
>
> </body>
> </html>

Mike Duffy

unread,
Dec 22, 2009, 11:57:38 PM12/22/09
to
David Mark <dmark....@gmail.com> wrote in
news:71a4f166-a164-4713...@33g2000vbe.googlegroups.com:

> Synchronous requests are always a bad idea.

I tried it both ways; the result is the same. I presumed sync would be
less trouble.

> Calling document.write on load is also a bad idea as it will wipe out
> the previously loaded document.

That's a good point. I was doing it just to avoid the neccessity of
constantly dismissing alert boxes while I was trying out various things.
I have replaced it with a textbox and switched to using asynchronous
calls to be more in line with the common usage of the XMLHttpRequest
object. It still works okay with IE8, but not with FF 3.5.3.

Here is the new code; it can be reached on-line at

http://pages.videotron.com/duffym/t.htm

<html lang="en">
<head>
<title>Test Server Time</title>

</head>

<body onLoad="test()">

<script type="text/javascript">
function logMessage(message) {
var dtext = document.forms.debug.debugtext.value;
document.forms.debug.debugtext.value = dtext + message + '\n';
return;
}

function test() {
var xmlhttp = new XMLHttpRequest();

// true = async; false = sync

true);

xmlhttp.onreadystatechange=function() {
if (xmlhttp.readyState==4) {
logMessage("Time at server: " + xmlhttp.getResponseHeader('Date'))
};

}
xmlhttp.send(null);
}
</script>

<p id="debug"><form name="debug">
<textarea name="debugtext" title="Debug" rows="10" cols="50" wrap="true">
</textarea></form></p>


</body>
</html>

David Mark

unread,
Dec 23, 2009, 12:24:10 AM12/23/09
to
On Dec 22, 11:57 pm, Mike Duffy <resp...@invalid.invalid> wrote:

Always set onreadystatechange before opening.

Thomas 'PointedEars' Lahn

unread,
Dec 23, 2009, 7:40:58 PM12/23/09
to
David Mark wrote:

Nonsense. For compatibility, it needs to come afterwards. At least older
Geckos reset the property value on open().


PointedEars
--
Anyone who slaps a 'this page is best viewed with Browser X' label on
a Web page appears to be yearning for the bad old days, before the Web,
when you had very little chance of reading a document written on another
computer, another word processor, or another network. -- Tim Berners-Lee

David Mark

unread,
Dec 23, 2009, 7:58:26 PM12/23/09
to
On Dec 23, 7:40 pm, Thomas 'PointedEars' Lahn <PointedE...@web.de>
wrote:

> David Mark wrote:
> > On Dec 22, 11:57 pm, Mike Duffy <resp...@invalid.invalid> wrote:
> >> function test() {
> >> var xmlhttp = new XMLHttpRequest();
>
> >> // true = async; false = sync
> >> xmlhttp.open("HEAD", "http://pages.videotron.com/duffym/index.htm",
> >> true);
>
> >> xmlhttp.onreadystatechange=function() {
> >> if (xmlhttp.readyState==4) {
> >> logMessage("Time at server: " + xmlhttp.getResponseHeader('Date'))
> >> };
>
> > Always set onreadystatechange before opening.
>
> Nonsense.  For compatibility, it needs to come afterwards.  At least older
> Geckos reset the property value on open().

Yes, I had that backwards. Thanks.

Mike Duffy

unread,
Dec 23, 2009, 8:25:13 PM12/23/09
to
Thomas 'PointedEars' Lahn <Point...@web.de> wrote in
news:3803771.b...@PointedEars.de:

> David Mark wrote:
>
>> On Dec 22, 11:57 pm, Mike Duffy <resp...@invalid.invalid> wrote:
>>> function test() {
>>> var xmlhttp = new XMLHttpRequest();
>>>
>>> // true = async; false = sync
>>> xmlhttp.open("HEAD", "http://pages.videotron.com/duffym/index.htm",
>>> true);
>>>
>>> xmlhttp.onreadystatechange=function() {
>>> if (xmlhttp.readyState==4) {
>>> logMessage("Time at server: " + xmlhttp.getResponseHeader('Date'))
>>> };
>>
>> Always set onreadystatechange before opening.
>
> Nonsense. For compatibility, it needs to come afterwards. At least
> older Geckos reset the property value on open().
>
>
> PointedEars

Changing the order as he suggested did fix my problem. (Thank you David!)

It did not, however seem to work perfectly. Each "refresh" in IE added a
line with the new updated time. However, in FF the identical time was
appended with each refresh.

I fixed that by appending:

"?en&rt=" + Math.random()

to the url. Out of curiousity, I wonder if the problem had anything to do
with the fact that my WSP always run the clock a few minutes slow.

In any case, at least I have a "working" function I can build on.

David Mark

unread,
Dec 23, 2009, 8:49:15 PM12/23/09
to
On Dec 23, 8:25 pm, Mike Duffy <resp...@invalid.invalid> wrote:
> Thomas 'PointedEars' Lahn <PointedE...@web.de> wrote innews:3803771.b...@PointedEars.de:

>
>
>
> > David Mark wrote:
>
> >> On Dec 22, 11:57 pm, Mike Duffy <resp...@invalid.invalid> wrote:
> >>> function test() {
> >>> var xmlhttp = new XMLHttpRequest();
>
> >>> // true = async; false = sync
> >>> xmlhttp.open("HEAD", "http://pages.videotron.com/duffym/index.htm",
> >>> true);
>
> >>> xmlhttp.onreadystatechange=function() {
> >>> if (xmlhttp.readyState==4) {
> >>> logMessage("Time at server: " + xmlhttp.getResponseHeader('Date'))
> >>> };
>
> >> Always set onreadystatechange before opening.
>
> > Nonsense.  For compatibility, it needs to come afterwards.  At least
> > older Geckos reset the property value on open().
>
> > PointedEars
>
> Changing the order as he suggested did fix my problem. (Thank you David!)

I told you _wrong_ (it must have been a long day). Put the order back
the way it was.

Something else must be wrong and I don't see what it is offhand. Your
code works in the Firebug console, except that logMessage bombs
looking for your form.

Mike Duffy

unread,
Dec 23, 2009, 11:36:01 PM12/23/09
to
David Mark <dmark....@gmail.com> wrote in
news:5c1b46f1-7a11-45f8...@f6g2000vbp.googlegroups.com:

> Something else must be wrong and I don't see what it is offhand. Your
> code works in the Firebug console, except that logMessage bombs
> looking for your form.

? I do not doubt you, but that was not my problem, FF just never did
anything. Actually, it did log the message one time but would never do it
again. The error console remained empty. On another occaision, I did see
error text appear in the console spontaneously a few minutes later. I was
trying various things, and as you may gather sometimes get mixed up about
what I have put in the file or javascript library. This is one of those
things I cannot debug offline because of the protocol / domain traversal
problem. (i.e file://C:/My Documents/... vs. http://videotron...)

Also, it might have something to do with the server time being so retarded.

Mike Duffy

unread,
Dec 23, 2009, 11:36:14 PM12/23/09
to
David Mark <dmark....@gmail.com> wrote in
news:5c1b46f1-7a11-45f8...@f6g2000vbp.googlegroups.com:

> Something else must be wrong and I don't see what it is offhand. Your
> code works in the Firebug console, except that logMessage bombs
> looking for your form.

? I do not doubt you, but that was not my problem, FF just never did

David Mark

unread,
Dec 24, 2009, 12:11:37 AM12/24/09
to
On Dec 23, 11:36 pm, Mike Duffy <resp...@invalid.invalid> wrote:

> David Mark <dmark.cins...@gmail.com> wrote innews:5c1b46f1-7a11-45f8...@f6g2000vbp.googlegroups.com:
>
> > Something else must be wrong and I don't see what it is offhand.  Your
> > code works in the Firebug console, except that logMessage bombs
> > looking for your form.
>
> ? I do not doubt you, but that was not my problem, FF just never did
> anything. Actually, it did log the message one time but would never do it
> again. The error console remained empty. On another occaision, I did see
> error text appear in the console spontaneously a few minutes later. I was
> trying various things, and as you may gather sometimes get mixed up about
> what I have put in the file or javascript library. This is one of those
> things I cannot debug offline because of the protocol / domain traversal
> problem. (i.e file://C:/My Documents/... vs.http://videotron...)

In FF go to about:config and change
security.fileuri.strict_origin_policy to false.

>
> Also, it might have something to do with the server time being so retarded.

What sort of time is retarded?

Mike Duffy

unread,
Dec 24, 2009, 9:43:47 AM12/24/09
to
David Mark <dmark....@gmail.com> wrote in
news:8af6ac3f-3ffc-4a29...@t42g2000vba.googlegroups.com:

>
> What sort of time is retarded?
>

The server I was tring to get the time from (my web service provider
"videotron") always has their clock set several minutes in the past.

I wanted to display exacty how much retarded it is, because that is how
long I need to wait after uploading a new document before it will pass
through web cache proxy servers. These are used, for example, by Google as
the source for a web page when you request a translation via url.

Mike Duffy

unread,
Dec 24, 2009, 9:46:56 AM12/24/09
to
David Mark <dmark....@gmail.com> wrote in
news:8af6ac3f-3ffc-4a29...@t42g2000vba.googlegroups.com:

>
> What sort of time is retarded?
>

The server I was tring to get the time from (my web service provider

Mike Duffy

unread,
Dec 25, 2009, 11:40:24 AM12/25/09
to
David Mark <dmark....@gmail.com> wrote in
news:8af6ac3f-3ffc-4a29...@t42g2000vba.googlegroups.com:

> On Dec 23, 11:36�pm, Mike Duffy <resp...@invalid.invalid> wrote:
>> David Mark <dmark.cins...@gmail.com> wrote

>

> In FF go to about:config and change
> security.fileuri.strict_origin_policy to false.

1) My apologies to all for the recent double-posting of my messages. AIEO
via Xnews was showing "Done. Waiting for confirmation." indefinitely.
Without the "Confirmation" I cannot resist the compulsion to post again,
despite the fact that it will usually end up making me look compulsive.

2) Thanks again David. As you may see, I have successfully added clocks to
all my web pages to show server time and local time.

http://pages.videotron.com/duffym/

3) Re your point above about security policies, thanks, I might use this on
a private area of my web site to get the correct time from a government
time server instead of from the local machine. But since this configuration
is not the installed default, I cannot assume that web visitors will have
this option (or the similar IE option) enabled.

But that brings up another question: How does Google implement an Ajax API
(such as the translation one I use extensively) to work without the warning
messages? They "google.com" are, in fact, receiving XML HTTP requests from
everyone all over the place. Most of these users use default security
settings. They are not bothered by those security warning messages.

The google code is obfuscted, I do not need to know THAT much how they do
it. I looked up (on the web) how to do this sort of thing in general, and
there are workarounds, but they all involve setting up a proxy on the end-
user's ISP system.

Do any of you know how they do it?

Dr J R Stockton

unread,
Dec 26, 2009, 5:37:16 PM12/26/09
to
In comp.lang.javascript message <Xns9CEC76BECB67Drespondinvalidinvali@85
.214.113.135>, Fri, 25 Dec 2009 16:40:24, Mike Duffy
<res...@invalid.invalid> posted:

>
>2) Thanks again David. As you may see, I have successfully added clocks to
>all my web pages to show server time and local time.

How do you get that to work for David and not for me?

>http://pages.videotron.com/duffym/

Putting the US flag first and the others in what looks like alphabetical
order of English form of language name is politically incorrect. The
flags should be in alphabetical order of the language currently being
shown, and the correct flag for English is of course the Cross of St
George. Latin & Esperanto seem to be missing.


The astro page has NaNs.

The puns page does not translate well.

--
(c) John Stockton, nr London, UK. ?@merlyn.demon.co.uk Turnpike v6.05.
Web <URL:http://www.merlyn.demon.co.uk/> - w. FAQish topics, links, acronyms
PAS EXE etc : <URL:http://www.merlyn.demon.co.uk/programs/> - see 00index.htm
Dates - miscdate.htm estrdate.htm js-dates.htm pas-time.htm critdate.htm etc.

David Mark

unread,
Dec 26, 2009, 6:56:09 PM12/26/09
to
On Dec 25, 11:40 am, Mike Duffy <resp...@invalid.invalid> wrote:

> David Mark <dmark.cins...@gmail.com> wrote innews:8af6ac3f-3ffc-4a29...@t42g2000vba.googlegroups.com:
>
> > On Dec 23, 11:36 pm, Mike Duffy <resp...@invalid.invalid> wrote:
> >> David Mark <dmark.cins...@gmail.com> wrote
>
> > In FF go to about:config and change
> > security.fileuri.strict_origin_policy to false.
>
> 1) My apologies to all for the recent double-posting of my messages. AIEO
> via Xnews was showing "Done. Waiting for confirmation." indefinitely.
> Without the "Confirmation" I cannot resist the compulsion to post again,
> despite the fact that it will usually end up making me look compulsive.

NP.

>
> 2) Thanks again David. As you may see, I have successfully added clocks to
> all my web pages to show server time and local time.
>
> http://pages.videotron.com/duffym/

I'll check it out when I get a chance...

>
> 3) Re your point above about security policies, thanks, I might use this on
> a private area of my web site to get the correct time from a government
> time server instead of from the local machine. But since this configuration
> is not the installed default, I cannot assume that web visitors will have
> this option (or the similar IE option) enabled.

The suggestion was just for local testing.

>
> But that brings up another question: How does Google implement an Ajax API
> (such as the translation one I use extensively) to work without the warning
> messages? They "google.com" are, in fact, receiving XML HTTP requests from
> everyone all over the place. Most of these users use default security
> settings. They are not bothered by those security warning messages.

I'll have to look at it.

>
> The google code is obfuscted, I do not need to know THAT much how they do
> it. I looked up (on the web) how to do this sort of thing in general, and
> there are workarounds, but they all involve setting up a proxy on the end-
> user's ISP system.
>
> Do any of you know how they do it?

Not sure until I look at it.

Mike Duffy

unread,
Dec 26, 2009, 10:34:01 PM12/26/09
to
David Mark <dmark....@gmail.com> wrote in
news:1990d22f-05ad-4307...@g12g2000vbl.googlegroups.com:

> Not sure until I look at it.

If you're curious. But like I said, it is not important for me. I have what
I want. They *might* be using the 1x1 invisible iframe trick to pass data
across domains. Thanks again.

Mike Duffy

unread,
Dec 26, 2009, 11:30:43 PM12/26/09
to
Dr J R Stockton <repl...@merlyn.demon.co.uk> wrote in
news:CiEk2TJc...@invalid.uk.co.demon.merlyn.invalid:

> How do you get that to work for David and not for me?
>
>>http://pages.videotron.com/duffym/

Are you saying that the clocks (local & server) do not work for you? I
have not yet added the support for old (IE6 & <) browsers. Which browser
are you using?


> Putting the US flag first and the others in what looks like
> alphabetical order of English form of language name is politically
> incorrect.

They are in alphabetic order of the drop-down list on the Google
"translate text" page, which is, I believe, exactly as you say it looks
like. English has been pushed to the start in order to reduce the
complexity of debugging.


> The flags should be in alphabetical order of the language
> currently being shown,

Probably if I were hosting the UN web site I would do as you say, but
that seems to me to add complexity that does really add value to the
product worthy of the effort nor the risk of unforseen complications. To
be fair, I suppose I should use the alphabetic order of the 2 char iso
language code, and put English (en) in it's proper place between Greek
(el) and Spanish (es). The next time I find myself working on that part
of my javascript include file I will do exactly that.


> ... the correct flag for English is of course


> the Cross of St George.

I did actually consider this. But many international users would not make
the connection. As far as that goes, the UK flag is more widely used on
the web to denote the English language. But since my web-site is written
in Quebec English, it makes more sense to use the American flag.

There is a certain body of opinion that holds that flags should not be
used at all for language selection. The problem of choosing which country
flag to use for Swahili was reduced (for me) to picking the country with
the largest number of Swahili speakers. The Indian flag is an obvious
choice for Hindi written in the Devanagari script, but what will I do
when other uniquely Indian languages become supported? I used the Chinese
flag twice, but I cannot forsee doing this for all 400 Indian languages.
And did you recognize the flag I used for Yiddish?


> Latin & Esperanto seem to be missing.

As soon as Google supports them, I will add them. And I cannot for the
life of me guess what flags I will use.


> The astro page has NaNs.

In the planetary positions, or in the tide (gravity gradient)
calculation? Everything has always worked okay for me. I would appreciate
details on the errors you encountered.


> The puns page does not translate well.

If you thinks that's bad, check out my poetry!

rf

unread,
Dec 27, 2009, 2:03:06 AM12/27/09
to
"Mike Duffy" <res...@invalid.invalid> wrote in message
news:Xns9CEC76BECB67Dre...@85.214.113.135...

> 2) Thanks again David. As you may see, I have successfully added clocks to
> all my web pages to show server time and local time.
>
> http://pages.videotron.com/duffym/

Your time is out by one hour. The southern half of the planet is in daylight
saving time right now.


Richard Maher

unread,
Dec 27, 2009, 2:16:24 AM12/27/09
to

"rf" <r...@z.invalid> wrote in message
news:KEDZm.64980$ze1....@news-server.bigpond.net.au...

> The southern half of the planet is in daylight
> saving time right now.

Oh no we're not! At least those of us not living in sunshine-challenged
States anyway :-)

Cheers Richard Maher
>
>


Evertjan.

unread,
Dec 27, 2009, 4:39:19 AM12/27/09
to
Dr J R Stockton wrote on 26 dec 2009 in comp.lang.javascript:

> Putting the US flag first and the others in what looks like alphabetical
> order of English form of language name is politically incorrect. The
> flags should be in alphabetical order of the language currently being
> shown, and the correct flag for English is of course the Cross of St
> George. Latin & Esperanto seem to be missing.

Using flags for languages is incorrect as:

Some languages would need to point to many flags, and
most flags should point to more languages than one.

Even "political correct" has a different meaning for near every flag.

Why not stick to the compromize of wikipedia?

The translations used are laughably incorrect,
and often are nnot understandasble to a native speaker
without consulting the English version.

Does this have anything to do with Javascript?

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)

Dr J R Stockton

unread,
Dec 28, 2009, 4:45:14 PM12/28/09
to
In comp.lang.javascript message <Xns9CEDEF2BDF04Brespondinvalidinvali@94
.75.214.90>, Sun, 27 Dec 2009 04:30:43, Mike Duffy
<res...@invalid.invalid> posted:

>Dr J R Stockton <repl...@merlyn.demon.co.uk> wrote in
>news:CiEk2TJc...@invalid.uk.co.demon.merlyn.invalid:
>
>> How do you get that to work for David and not for me?
>>
>>>http://pages.videotron.com/duffym/
>
>Are you saying that the clocks (local & server) do not work for you? I
>have not yet added the support for old (IE6 & <) browsers. Which browser
>are you using?

I see no clocks with Firefox 3.0.15, IE, Chrome, Opera, Safari. You did
write "I have successfully added clocks to all my web pages to show
server time and local time.", so I only looked at some pages.

>> Putting the US flag first and the others in what looks like
>> alphabetical order of English form of language name is politically
>> incorrect.
>
>They are in alphabetic order of the drop-down list on the Google
>"translate text" page, which is, I believe, exactly as you say it looks
>like. English has been pushed to the start in order to reduce the
>complexity of debugging.
>
>
>> The flags should be in alphabetical order of the language
>> currently being shown,
>
>Probably if I were hosting the UN web site I would do as you say, but
>that seems to me to add complexity that does really add value to the
>product worthy of the effort nor the risk of unforseen complications. To
>be fair, I suppose I should use the alphabetic order of the 2 char iso
>language code, and put English (en) in it's proper place between Greek
>(el) and Spanish (es). The next time I find myself working on that part
>of my javascript include file I will do exactly that.
>
>
>> ... the correct flag for English is of course
>> the Cross of St George.
>
>I did actually consider this. But many international users would not make
>the connection. As far as that goes, the UK flag is more widely used on
>the web to denote the English language. But since my web-site is written
>in Quebec English, it makes more sense to use the American flag.

You should be able to use both. But Wales, for which you have a flag,
is part of the UK. England is the only major part of the UK which has
no surviving active indigenous language other than English. But I think
you'd be hard pressed to find anyone (except maybe in Patagonia) who
would prefer Google's Welsh to your quasi-American English.

Take a look at my home page, via sig., which gives that translation
facility more economically.


>There is a certain body of opinion that holds that flags should not be
>used at all for language selection. The problem of choosing which country
>flag to use for Swahili was reduced (for me) to picking the country with
>the largest number of Swahili speakers. The Indian flag is an obvious
>choice for Hindi written in the Devanagari script, but what will I do
>when other uniquely Indian languages become supported? I used the Chinese
>flag twice, but I cannot forsee doing this for all 400 Indian languages.
>And did you recognize the flag I used for Yiddish?
>
>
>> Latin & Esperanto seem to be missing.
>As soon as Google supports them, I will add them. And I cannot for the
>life of me guess what flags I will use.

For Latin, a bust of Caesar should be recognisable; and Zamenhof looks
quite different. But the Wiki Zamenhof article shows what is presumably
an Esperanto flag, confirmed by the Esperanto article. The Rome article
shows a flag, which could be used - or an SPQR logo.


>> The astro page has NaNs.
>In the planetary positions, or in the tide (gravity gradient)
>calculation? Everything has always worked okay for me. I would appreciate
>details on the errors you encountered.

In the text, e.g. "Currently, the Moon is NaN % illuminated."
Obviously, a lot is not shown.

MSIE8 raises errors such as

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1;
Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR
3.0.04506.30; .NET CLR 3.0.04506.648; .NET CLR 3.0.4506.2152; .NET CLR
3.5.30729; OfficeLiveConnector.1.3; OfficeLivePatch.0.0)
Timestamp: Mon, 28 Dec 2009 20:42:07 UTC

Message: 'google.loader.ClientLocation.latitude' is null or not an
object
Line: 36
Char: 1
Code: 0
URI: http://pages.videotron.com/duffym/astro.htm

Perhaps you are expecting readers to have installed something?

Maybe

uLat = google.loader.ClientLocation.latitude;

returns "undefined", which then should be tested for (Google has not
been told my latitude).

I've now quickly looked at the code. Perhaps HTML should show a
conspicuous area containing "If you can read this when loading is
finished, something is not working", and either replace it with results
or hide it.


For function jd(obs,actual) in astro.htm, you should be able to use
something *like*

new Date(obs.year, obs.month-1, obs.day) / 864e5 + constant

perhaps with a Date.UTC() inside.

You can use now.getFullYear instead of function getFullYear(now), or, if
you want to use only getYear, see :

function getFY(D) { var YE // needs full test in all browsers
YE = 1970 + Math.round(D.getTime() / 31556952000) // s per Greg yr
return YE + (D.getYear()-YE)%100 }

in <URL:http://www.merlyn.demon.co.uk/js-date0.htm#gFY>, in which
31556952000 only has to be roughly right (YE can be decades in error
without affecting the answer).

>> The puns page does not translate well.
>
>If you thinks that's bad, check out my poetry!

Unreadable in English, because of the colour and size.

--
(c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 MIME.
Web <URL:http://www.merlyn.demon.co.uk/> - FAQish topics, acronyms, & links.
Proper <= 4-line sig. separator as above, a line exactly "-- " (RFCs 5536/7)
Do not Mail News to me. Before a reply, quote with ">" or "> " (RFCs 5536/7)

JR

unread,
Dec 28, 2009, 7:35:51 PM12/28/09
to
On Dec 28, 7:45 pm, Dr J R Stockton <reply0...@merlyn.demon.co.uk>
wrote:

> >Probably if I were hosting the UN web site I would do as you say, but
> >that seems to me to add complexity that does really add value to the
> >product worthy of the effort nor the risk of unforseen complications. To
> >be fair, I suppose I should use the alphabetic order of the 2 char iso
> >language code, and put English (en) in it's proper place between Greek
> >(el) and Spanish (es). The next time I find myself working on that part
> >of my javascript include file I will do exactly that.
>
> >> ... the correct flag for English is of course
> >> the Cross of St George.
>
> >I did actually consider this. But many international users would not make
> >the connection. As far as that goes, the UK flag is more widely used on
> >the web to denote the English language. But since my web-site is written
> >in Quebec English, it makes more sense to use the American flag.
>
> You should be able to use both.  But Wales, for which you have a flag,
> is part of the UK.  England is the only major part of the UK which has
> no surviving active indigenous language other than English.

I've heard about the Northumbrian (Tyneside region of England) dialect
called 'Geordie'.

Eeeh man, ahm gannin te the booza.

--
JR

Dr J R Stockton

unread,
Dec 30, 2009, 3:24:12 PM12/30/09
to
In comp.lang.javascript message <55bf5dab-2dda-4e85-90aa-289b6c6a81b5@37
g2000vbn.googlegroups.com>, Mon, 28 Dec 2009 16:35:51, JR <groups_jr-
1...@yahoo.com.br> posted:

>On Dec 28, 7:45�pm, Dr J R Stockton <reply0...@merlyn.demon.co.uk>
>wrote:

>> >> ... the correct flag for English is of course


>> >> the Cross of St George.
>>
>> >I did actually consider this. But many international users would not make
>> >the connection. As far as that goes, the UK flag is more widely used on
>> >the web to denote the English language. But since my web-site is written
>> >in Quebec English, it makes more sense to use the American flag.
>>
>> You should be able to use both. �But Wales, for which you have a flag,
>> is part of the UK. �England is the only major part of the UK which has
>> no surviving active indigenous language other than English.
>
>I've heard about the Northumbrian (Tyneside region of England) dialect
>called 'Geordie'.

A dialect is not a language. Spoken Geordie is just English peculiarly
pronounced with a few local words. Educated Geordies write in normal
English.

0 new messages