Re: OT - Quick JavaScript Question
| From: | Chris Shiflett | Date: | Tue, 28 Oct 2003 19:14:26 +0000 |
| Subject: | Re: OT - Quick JavaScript Question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-167911@lists.php.net to get a copy of this message | ||
--- Jake McHenry <linux@nittanytravel.com> wrote:
> I know this is a bit off topic, but does anyone know of a way I can
> take the server time in php and get it into javascript?
Well, that part isn't off-topic, in my opinion.
JavaScript and HTML are the exact same thing from the perspective of PHP;
they're output. So yes, you can get any information from PHP to JavaScript by
writing it:
<script language="javascript">
...
<?
$ts = time();
echo "var ts = $ts;\n";
?>
...
</script>
My JavaScript syntax might be wrong, but hopefully you get the idea.
Chris
=====
My Blog
http://shiflett.org/
HTTP Developer's Handbook
http://httphandbook.org/
RAMP Training Courses
http://www.nyphp.org/ramp