以HTML格式显示日期戳脚本 [英] Display datestamp script in HTML
问题描述
大家好。我有HTML网页,我上传了一个更新的文件
总是被称为document.pdf。用户到达那里,点击图标和
下载document.pdf。
在用户点击获取文档的图标/链接下方,有没有
方式显示document.pdf的日期戳?
即:您要下载的文件已更新:2007年3月2日>
我的网页文件名称为index.html(我想要显示
日期戳的页面)
我所在的目录可以存储脚本名为/ bin
我想要检索日期戳的文件名为
document.pdf
我在互联网上搜索了这么简单的剧本但是找不到任何
。我不是程序员,所以请耐心等待。我需要将什么代码
粘贴到index.html中以显示
document.html的实际日期戳?服务器是Apache 1.3.26
我能够找到以下代码,但这显示了HTML文件本身的
修改日期,而不是来自另一个文件。
<! - #config timefmt ="%B%e,%Y" - >
<脚本类型=" text / javascript">
//页面上次修改日期脚本 - 来自JavaScriptKit.com
//访问 http://www.javascriptkit.com 获取完整源代码
//此通知必须保持原样使用
var docmodified =''<! - #echo var =" LAST_MODIFIED" - >''
document.write(''此页面最后修改时间:''+ docmodified)
< / script>
感谢您的任何建议!
当城市睡觉时,Phil M(ji****@trexagi.net)狂热地打字.. 。
大家好。我有HTML网页,我上传了一个更新的文件
总是被称为document.pdf。用户到达那里,点击图标和
下载document.pdf。
在用户点击获取文档的图标/链接下方,有没有
方式显示document.pdf的日期戳?
即:您要下载的文件已更新:2007年3月2日>
[...]
>
我能找到下面的代码,但这显示了HTML文件本身的
修改日期,而不是其他文件。
[...]
最有可能因为javascript在客户端运行,但你需要
有关服务器上文件的信息。您可以使用在服务器端运行的一些非常简单的PHP来完成此操作。有点像,在你的
index.html;
<! - 示例开始 - >
< p>< a href =" document.pdf> document.pdf< / a(最后修改:
<?php
回音日期(F d YH:i:s。,filemtime(" document.pdf"));
?>
)< / p>
<! - 示例结束 - >
....并将index.html重命名为index.php ...
我建议先做一个测试版,但为了确保...
希望有所帮助。
Nige
-
Nigel Moss http://www.nigenet.org.uk
邮件地址将会反弹。 ni***@DOG.nigenet.org.uk |带上狗。 out!
你的母亲吃了我的狗!,不是他的全部!
当城市睡觉时, nice.guy.nige(ni********@deadspam.com)狂热
键入...
< ; - - 开始示例 - >
< p>< a href =" document.pdf> document.pdf< / a(最后修改:
<?php
echo date(" F d YH:i:s。",filemtime(" document.pdf"));
< blockquote class =post_quotes>
>>
最后一个应该是一个问号(?)后跟一个直角支架
(>)在?> ...但是我的新闻阅读器决定抛弃问号...只需
来澄清。
干杯,
Nige
-
Nigel Moss http://www.nigenet.org.uk
邮件地址将反弹。 ni***@DOG.nigenet.org.uk |带上狗。 out!
你的母亲吃了我的狗!,不是他的全部!
>简单的PHP在服务器端运行。在你的
> index.html;
感谢您的代码。根据建议,我上传了这个:
http:/ /www.greekradio.net/psa.php
并给出一个解析错误
如果您看不到源代码这里再次出现在plian文本中:
http://www.greekradio。 net / psa.txt
页面应该看起来像这样(加上日期戳我正在尝试
包含)
感谢您的任何建议。
Hi all. I have am HTML web page where I upload an updated file which
is always called document.pdf. Users get there, click on the icon and
download the document.pdf.
Below the icon/link where users click to get document, is there any
way to display the datestamp of document.pdf?
ie: the document you''re about to download was updated: March 2 2007
My web page file name is called index.html (page where I want the
datestamp to de displayed)
The directory where I can store scripts is called /bin
The file from which I want the datestamp to be retrieved is called
document.pdf
I searched the Internet for such a simple script but couldn''t find
any. I''m not a programmer, so please bear with me. What code do I
have to paste in the index.html to display the actual datestamp of
document.html? The server is Apache 1.3.26
I was able to find the following code, but this displays the
modification date of the HTML file itself, not from another file.
<!--#config timefmt="%B %e, %Y"-->
<script type="text/javascript">
//Page Last Modified Date script- By JavaScriptKit.com
//Visit http://www.javascriptkit.com for full source code
//This notice must stay intact for use
var docmodified=''<!--#echo var="LAST_MODIFIED" -->''
document.write(''This page was last modified: ''+docmodified)
</script>
Thanks for any suggestions!
While the city slept, Phil M (ji****@trexagi.net) feverishly typed...
Hi all. I have am HTML web page where I upload an updated file which
is always called document.pdf. Users get there, click on the icon and
download the document.pdf.
Below the icon/link where users click to get document, is there any
way to display the datestamp of document.pdf?
ie: the document you''re about to download was updated: March 2 2007
[...]
>
I was able to find the following code, but this displays the
modification date of the HTML file itself, not from another file.[...]
Most likely because the javascript runs on the client, but you need
information about a file on the server. You could do this with some pretty
simple PHP which runs on the server-side. Something like, in your
index.html;
<!-- Start of example -->
<p><a href="document.pdf>document.pdf</a(last modified:
<? php
echo date("F d Y H:i:s.", filemtime("document.pdf"));
?>
)</p>
<!-- end of example -->
.... and rename your index.html to index.php...
I would recommend doing a test version first though just to make sure...
Hope that helps.
Nige
--
Nigel Moss http://www.nigenet.org.uk
Mail address will bounce. ni***@DOG.nigenet.org.uk | Take the DOG. out!
"Your mother ate my dog!", "Not all of him!"
While the city slept, nice.guy.nige (ni********@deadspam.com) feverishly
typed...<!-- Start of example -->
<p><a href="document.pdf>document.pdf</a(last modified:
<? php
echo date("F d Y H:i:s.", filemtime("document.pdf"));>>
That last should be a question mark (?) followed by a right angled bracket
(>) as in ?>... but my newsreader decided to ditch the question mark... Just
to clarify.
Cheers,
Nige
--
Nigel Moss http://www.nigenet.org.uk
Mail address will bounce. ni***@DOG.nigenet.org.uk | Take the DOG. out!
"Your mother ate my dog!", "Not all of him!"
>simple PHP which runs on the server-side. Something like, in your>index.html;Thanks for the code. As per the suggestion, I uploaded this:
http://www.greekradio.net/psa.php
and gives a parse error
in case you can''t see the source code here it is again in plian text:
http://www.greekradio.net/psa.txt
the page should look someting like this (plus the datestamp I''m trying
to include)
Thanks for any suggestions.
这篇关于以HTML格式显示日期戳脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!