| 域名空间 下载中心 社区论坛 信息公告 my小屋 |
![]() |
联系我们 设为首页 加入收藏 |
|
首页 | 新闻资讯 | 编程开发 | 网页设计 | 图形图象 | 网络媒体 | 网站模板 | 数 据 库 | 投稿 论坛 | 操作系统 | 系统优化 | 网络安全 | 黑客技术 | 硬件学堂 | 硬件报价 | 服 务 器 | 地图 专题 | 应用软件 | 聊天通讯 | q q 专栏 | 建站经验 | 在线工具 | 站长club | 注 册 表 | 旧版 社会 | 游戏娱乐 | 设计欣赏 | 疑难解答 | 社区论坛 | 网络赚钱 | 网站地图 | 广告服务 | 服务 |
| 新版上线![旧版] | |||||
注:打开慢时请稍等
|
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 only if (activedocument.fullname == activedocument.localfullname) { var name = activedocument.localfullname; if (application.readablefileexists(name)) { // if document has never been saved, do nothing var 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 showing application.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); 编辑:黑鹰 [发送给好友] [打印本页] [关闭窗口] [返回顶部] 上一篇:javascript实例教程(20-9) 下一篇:javascript实例教程(20-11) 转载请注明来源:www.iyit.net 特别声明: 本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。 |
| 最新更新 | 热点排行 | 推荐新闻 | |||||||||||||||||||||||||||||||||||||||||||||||||||||
|
|
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||
| 友情链接 | ||||||
| 设置首 页 - 版权声明 - 广告服务 - 关于我们 - 联系我们 - 友情连接 |
| |||||||