
Signature
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
> With ASP-jscript you can do:
ASP ? that's a windows thing... right ?
> <script language='jscript' runat='server'>
> response.write(new Date());
[quoted text clipped - 4 lines]
>
> What is an "html doc"?
those things that you can find in the document root of for example an
apache server ?
> Why one line? Is this a school assignment?
Uhm no... but I can have a php script report the time, so if I can
request a "html doc" than i can read that script's output and get the
time that way.
Randy Webb - 29 Nov 2007 09:23 GMT
Ron Croonenberg said the following on 11/29/2007 3:10 AM:
<snip>
>> Why one line? Is this a school assignment?
>
> Uhm no... but I can have a php script report the time, so if I can
> request a "html doc" than i can read that script's output and get the
> time that way.
function loadJSFile(fileURL){
if (document &&
document.createElement &&
document.appendChild &&
document.getElementsByTagName)
{
var newScript = document.createElement('script');
newScript.type = "text/javascript";
newScript.src = fileURL;
document.getElementsByTagName('head')[0].appendChild(newScript);
}
}
loadJSFile('getTimeOnTheServer.php')
And then have getTimeOnTheServer.php return the time, along with a
function call to do something with the time. Instead of having PHP just
return a one line file with the time, it would look something like this:
var serverTime = <?php echo time() ?>;
someFunctionInThePageToDoSomethingWithTheTimeVariable();

Signature
Randy
Chance Favors The Prepared Mind
comp.lang.javascript FAQ - http://jibbering.com/faq/index.html
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Ron Croonenberg - 29 Nov 2007 14:58 GMT
Hi Randy,
thanks, I really appreciate it.
> Ron Croonenberg said the following on 11/29/2007 3:10 AM:
>
[quoted text clipped - 27 lines]
> var serverTime = <?php echo time() ?>;
> someFunctionInThePageToDoSomethingWithTheTimeVariable();
Evertjan. - 29 Nov 2007 17:40 GMT
Ron Croonenberg wrote on 29 nov 2007 in comp.lang.javascript:
>> With ASP-jscript you can do:
>
> ASP ? that's a windows thing... right ?
ASP allows serverside j[ava]script
>> <script language='jscript' runat='server'>
>> response.write(new Date());
[quoted text clipped - 7 lines]
> those things that you can find in the document root of for example an
> apache server ?
I wouldn't know, I asked you.
>> Why one line? Is this a school assignment?
>
> Uhm no... but I can have a php script report the time, so if I can
> request a "html doc" than i can read that script's output and get the
> time that way.
php is off topic on this NG. Please aske in a php NG.
And why one line?

Signature
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Ron Croonenberg - 30 Nov 2007 00:47 GMT
>> ASP ? that's a windows thing... right ?
>
> ASP allows serverside j[ava]script
I was kidding, I know what ASP is. We're running *nix boxes though, and
we don't really need asp.
>>> <script language='jscript' runat='server'>
>>> response.write(new Date());
[quoted text clipped - 16 lines]
>
> And why one line?