大雀软件园

首页 软件下载 安卓市场 苹果市场 电脑游戏 安卓游戏 文章资讯 驱动下载
技术开发 网页设计 图形图象 数据库 网络媒体 网络安全 站长CLUB 操作系统 媒体动画 安卓相关
当前位置: 首页 -> 网页设计 -> 网页特效 -> Javascript实例教程(20-10)

Javascript实例教程(20-10)

时间: 2021-07-31 作者:daque

hotmetal中运用javascript 5.还好吗编写脚从来查看上回窜改的日子这个on_document_activate宏是查看磁盘上的文献能否有与运用hotmetal编纂的暂时文书档案沟通的上回窜改的日子。它提醒用户该做什么以防日子不配合。以次是这个宏的简直代码:<macro name="on_document_activate" lang="jscript" id="44" tooltip="hide_on_document_activate" desc="runs macro: hide_on_document_activate"><![cdata[// do this for local documents onlyif (activedocument.fullname == activedocument.localfullname) {var name = activedocument.localfullname;if (application.readablefileexists(name)) { // if document has never been saved, do nothingvar fso = new activexobject("scripting.filesystemobject");var f = fso.getfile(name);var newmod = date.parse(f.datelastmodified);var props = activedocument.customdocumentproperties;if (props.count != 0) {oldmod = props.item("lastmod").value;if (oldmod != newmod) {var yes = 6;var no = 7;var msg = "the disk version of this document has changed from the\n";msg += "version in memory. do you want to re-open the document?";var ret = application.messagebox(msg, 36, "document changed");if (ret == yes) {activedocument.reload();}// reset the timestamp regardless of the user's response// this will prevent the dialog from always showingapplication.run("on_document_open_complete");}}}}]]></macro>咱们再查看文献能否承载了: activedocument.fullname == activedocument.localfullname。而后咱们考证一下文献能否被生存到磁盘中: application.readablefileexists(name). 一致于前方的on_document_open_complete 宏,咱们创造一个activex控件而且索取出文献的上回窜改的日子,代码如次:var fso = new activexobject("scripting.filesystemobject");var f = fso.getfile(name);var newmod = date.parse(f.datelastmodified);

热门阅览

最新排行

Copyright © 2019-2021 大雀软件园(www.daque.cn) All Rights Reserved.