vbscript写的网页备忘录
来源:互联网 发布:python 加减法 编辑:程序博客网 时间:2024/06/07 00:01
今天翻出来很早之前写的一个备忘录,只要这个网页打开的,就可以实现定时提醒功能。
代码为vbscript编写,现在的高版本ie已经不再支持,只有按下F12,选择低版本的ie了。
设置
添加备忘录
当前备忘情况
帮助信息
主要代码:
<!--设计者:uruseibest--><!--blog:http://blog.csdn.net/uruseibest --><!--修改时间:2008.10.15 20:00--><!--完成时间:2008.10.15 20:00--><html><head><meta http-equiv="Content-Type" Content="text/html; Charset=gb2312"><title>备忘录</title><style>body { font-size: 12px; border: none; font-family:Arial,宋体; overflow:none; padding:0px; margin:0px; background-color:#000100; }.stylesystime{ color:white; font-size:10pt; } #menu a:visited{ color:red; text-decoration:none; }#menu a:link{ color:red; text-decoration:none; }#menu a:hover{ color:white; text-decoration:none; background-color:blue; }#menu a:active{ color:red; text-decoration:none; } .viewtable{ font-size: 12px; border: none; font-family:Arial,宋体; overflow:none; padding:0px; margin:0px; background-color:#000100; color:white; }.inputtype{ font-size:12px; font-family:Arial,宋体; border-color:#000066; padding:0px; margin:0px; width:250px; height:20px; } td { font-size: 12px; font-family:Arial,宋体; }.showtop{ border-top:1px solid #9fccff; border-right:none; border-left:none; border-bottom:none; } .showleft{ border-top:none; border-right:none; border-left:1px solid #484977; border-bottom:none; } .showright{ border-top:none; border-right:1px solid #9fccff; border-left:none; border-bottom:none; } .showbottom{ border-top:none; border-right:none; border-left:none; border-bottom:1px solid #484977; } .tastyle{ border:none; background-color:transparent; color:white; width:220px; }</style><script language=vbscript>dim wFileNamedim intMemcountdim strMemdim ClockWavdim ShowCnTimedim PlayWavdim ShowNotsub loadsys() LoadSetup Getmem SetSystimeend subsub LoadSetup() ShowCnTime="0" PlayWav="1" ShowNot="1" if ShowCnTime="1" then chkSet1.checked=true else chkSet1.checked =false if PlayWav="1" then chkSet2.checked=true else chkSet2.checked =false if ShowNot="1" then chkSet3.checked=true else chkSet3.checked =falseend subsub sysSet1() if ChkSet1.checked=true then ShowCnTime="1" else ShowCnTime="0" end if showsystimeend subsub sysSet2() if ChkSet2.checked=true then PlayWav="1" else PlayWav="0" end ifend subsub sysSet3() if ChkSet3.checked=true then ShowNot="1" else ShowNot="0" end ifend subsub Getmem() dim fs dim sysPath set fs=createobject("scripting.filesystemobject") sysPath=fs.GetSpecialFolder(WindowsFolder) wFileName=syspath & "\Mem.txt" if fs.FileExists(wFileName)=false then intmemcount=0 else dim Wf set Wf=fs.OpenTextFile(wFileName,1) dim strAll strAll=Wf.readall wf.close strMem=split(strAll,"*") intMemCount=0 if ubound(strMem)>=0 then dim intI for intI=0 to ubound(strMem) if (left(strMem(intI),2)="&%") and (right(strMem(intI),2)="&%") then intMemCount=intMemCount+1 strMem(intI)=replace(strMem(intI),"&%","") strMem(intI)=strMem(intI) & ",0" end if next end if end if GetWav(sysPath) ShowTimeoutMemend subsub GetWav(path) dim fs set fs=createobject("scripting.filesystemobject") if fs.FileExists(path & "\media\notify.wav")=true then ClockWav=path & "\media\notify.wav" ChkSet2.disabled=false else ClockWav="" ChkSet2.disabled=true divset2.innerHTML="(不可用,请查看帮助)" end ifend subsub ShowTimeoutMem() if ShowNot="0" then dim intI if intMemcount>0 then for intI=0 to ubound(strMem) dim substrMem dim MemTime,nowTime substrMem=split(strMem(intI),",") MemTime=strFormatTime(substrMem(0)) nowTime=GetCurrentF if (datediff("n",Memtime,nowTime)>=0) and (substrMem(3)="0") then substrMem(3)="1" end if strMem(intI)=join(substrMem,",") next end if WMemFile(1) end ifend subsub SetSystime() showsystime getMeminfo Mem_show window.setTimeout "setsystime",1000end subsub showsystime() dim y,m,d,hh,mm,ss,w,ww,systime if ShowCnTime="0" then y=year(now) m=right("00" & month(now) ,2) d=right("00" & day(now) ,2) hh=right("00" & hour(now) ,2) mm=right("00" & minute(now) ,2) ss=right("00" & second(now) ,2) w=weekday(now,vbMonday) ww=GetCnW(w) systime= y & "-" & m & "-" & d & " " & hh & ":" & mm & ":" & ss & " " & ww else y=GetCn(year(now)) m=GetCn(month(now)) d=GetCn(day(now)) hh=GetCn(hour(now)) mm=GetCn(minute(now)) ss=GetCn(second(now)) w=weekday(now,vbMonday) ww=GetCnW(w) systime= y & "年" & m & "月" & d & "日 " & "<br>" & hh & "时" & mm & "分" & ss & "秒 " & ww end if showtime.innerHTML =systimeend subfunction NumToCn(intNum) select case intNum case 0:ww="零" case 1:ww="一" case 2:ww="二" case 3:ww="三" case 4:ww="四" case 5:ww="五" case 6:ww="六" case 7:ww="七" case 8:ww="八" case 9:ww="九" end select NumToCn=wwend functionfunction GetCn(intNum) dim strNum,strCn dim i strNum=cstr(intNum) select case len(strNum) case 1 strCn=NumToCn(intNum) case 2 if intnum<20 then strCn="十" & _ NumToCn(cint(mid(strNum,2,1))) else strCn=NumToCn(cint(mid(strNum,1,1))) & _ "十" & _ NumToCn(cint(mid(strNum,2,1))) end if case 4 strCn=NumToCn(cint(mid(strNum,1,1))) & _ NumToCn(cint(mid(strNum,2,1))) & _ NumToCn(cint(mid(strNum,3,1))) & _ NumToCn(cint(mid(strNum,4,1))) end select if strNum="10" then strCn="十" GetCn=strCnend functionfunction GetCnW(intNum) dim ww select case intNum case 1,2,3,4,5,6 ww="星期" & NumToCn(intNum) case 7 ww="星期日" case else ww="星期?" end select GetCnW=wwend functionfunction strFormatTime(strFormated) strFormatTime=mid(strFormated,1,4) & "-" & _ mid(strFormated,5,2) & "-" & _ mid(strFormated,7,2) & " " & _ mid(strFormated,9,2) & ":" & _ mid(strFormated,11,2) end functionsub ShowDiv(intIndex) showsetdiv.style.display="none" showadddiv.style.display="none" showviewdiv.style.display="none" showhelpdiv.style.display="none" select case intIndex case 1 showsetdiv.style.display="block" case 2 memaddinfo.innerHTML="" txtMemTime.value=GetCurrentF showadddiv.style.display="block" case 3 ShowMem showviewdiv.style.display="block" case 4 showhelpdiv.style.display="block" end select menuclose.style.visibility ="visible"end subsub Mem_show() dim intI if intMemcount>0 then for intI=0 to ubound(strMem) dim substrMem dim MemTime,MemDone,MemShow dim nowTime substrMem=split(strMem(intI),",") MemTime=strFormatTime(substrMem(0)) MemDone=substrMem(3) MemShow=substrMem(4) nowTime=GetCurrentF if (datediff("n",Memtime,nowTime)>=0) and (MemDone="0") then substrMem(4)="1" strMem(intI)=join(substrMem,",") end if next ShowMemInDiv end ifend subsub AddMem() dim s1,s2,s3 s1=txtMemTime.value s2=txtMemTitle.value s3=txtMemContent.value if(mid(s1,5,1)<>"-") or (mid(s1,8,1)<>"-") or (mid(s1,11,1)<>" ") or (mid(s1,14,1)<>":") or (len(s1)<>16) then memaddinfo.innerHTML ="<font color='red'>错误:</font>时间格式错误,请重新填写。" exit sub end if if not isdate(s1) then memaddinfo.innerHTML ="<font color='red'>错误:</font>输入了错误的时间,请重新填写。" exit sub end if if trim(s2)="" then memaddinfo.innerHTML ="<font color='red'>错误:</font>标题不允许为空。" exit sub end if if len(trim(s3))>50 then memaddinfo.innerHTML ="<font color='red'>错误:</font>内容的长度限制在50字以内。" exit sub end if dim MemTime,MemTitle,MemContent MemTime=mid(s1,1,4) & _ mid(s1,6,2) & _ mid(s1,9,2) & _ mid(s1,12,2) & _ mid(s1,15,2) MemTitle=replaceTxt(trim(s2)) MemContent=replaceTxt(trim(s3)) if intMemcount=0 then redim strMem(0) strMem(0)=MemTime & "," & MemTitle & "," & MemContent & ",0,0" else dim intTemp intTemp=ubound(strMem)+1 redim Preserve strMem(intTemp) strMem(intTemp)=MemTime & "," & MemTitle & "," & MemContent & ",0,0" end if intMemCount=ubound(strMem)+1 dim Fso set Fso=createobject("scripting.filesystemobject") dim AppendFs set AppendFs=fso.OpenTextFile(wFileName,8,true) if intMemcount=1 then AppendFs.write "&%" & MemTime & "," & MemTitle & "," & MemContent & ",0&%" else AppendFs.write "*&%" & MemTime & "," & MemTitle & "," & MemContent & ",0&%" end if AppendFs.close set Fso=nothing txtMemTime.value=GetCurrentF txtMemTitle.value="" txtMemContent.value="" memaddinfo.innerHTML ="<font color='red'>成功:</font>添加新备忘 " & MemTitle & "成功。" getMeminfoend subfunction replaceTxt(strReplace) dim s s=strReplace s=replace(s,"<","<") s=replace(s,">",">") s=replace(s,",",",") s=replace(s,"*","*") s=replace(s,vbcrlf,"<br>") s=replace(s,"%","%") s=replace(s,"&","&") replaceTxt=send functionfunction GetCurrentF() dim strTemp strTemp=year(now) & "-" & _ right("00" & month(now) ,2) & "-" & _ right("00" & day(now) ,2) & " " & _ right("00" & hour(now) ,2) & ":" & _ right("00" & minute(now) ,2) GetCurrentF=strTemp end functionsub ShowMem() dim intI dim strOut dim i strOut="<table width='100%' border='0' class='viewtable'>" strOut=strOut & "<tr>" strOut=strOut & "<td width='10'> </td>" strOut=strOut & "<td width='100'>时间</td>" strOut=strOut & "<td width='*'>标题</td>" strOut=strOut & "<td align='center' width='24'>到时</td>" strOut=strOut & "<td align='center' width='24'>显示</td>" strOut=strOut & "<td align='center'>删除</td>" strOut=strOut & "</tr>" if intMemcount>0 then for i=0 to ubound(strMem) dim substrMem dim MemTime,MemTitle,MemTimeout,MemShow,MemDone dim nowTime substrMem=split(strMem(i),",") MemTime=strFormatTime(substrMem(0)) MemTitle=substrMem(1) nowTime=GetCurrentF if datediff("n",Memtime,nowTime)<0 then MemTimeout="否" else MemTimeout="是" end if if substrMem(4)=0 then MemShow="<input type='checkbox' id='chkshowmem" & i & "' name='chkshowmem" & i & "' onclick='memshowed(" & i & ")'>" else MemShow="<input type='checkbox' id='chkshowmem" & i & "' name='chkshowmem" & i & "' checked='checked' onclick='memshowed(" & i & ")'>" end if strOut=strOut & "<tr>" strOut=strOut & "<td>" & cstr(i+1) & "</td>" strOut=strOut & "<td>" & MemTime & "</td>" strOut=strOut & "<td>" & MemTitle & "</td>" strOut=strOut & "<td align='center'>" & MemTimeout & "</td>" strOut=strOut & "<td align='center'>" & MemShow & "</td>" strOut=strOut & "<td align='center'><input type='button' value='删除' name='btnmemdel(" & i & ")' id='btndel' onclick='memdel(" & i & ")'></td>" strOut=strOut & "</tr>" next else strOut=strOut & "<tr><td colspan='7'>目前没有设置备忘</td></tr>" end if strOut=strOut & "</table>" showviewdiv.innerHTML =strOut end subsub closeMenu() showsetdiv.style.display="none" showadddiv.style.display="none" showviewdiv.style.display="none" showhelpdiv.style.display="none" menuclose.style.visibility ="hidden"end subsub memshowed(intIndex) dim substrMem substrMem=split(strMem(intIndex),",") if document.all("chkshowmem" & intIndex).checked=true then substrMem(4)="1" else substrMem(4)="0" end if strMem(intIndex)=join(substrMem,",") ShowMemInDivend subsub ShowMemInDiv() showmemdiv.innerHTML ="" dim intPlaysound dim intI dim strShowmem strShowmem="" intPlaysound=0 if intMemcount=0 then exit sub for intI=0 to Ubound(strMem) dim substrMem substrMem=split(strMem(intI),",") dim MemTime MemTime=strFormatTime(substrMem(0)) if substrMem(4)="1" then strShowmem=strShowmem & "<table class='viewtable' width='100%'>" strShowmem=strShowmem & "<tr>" strShowmem=strShowmem & "<td colspan='2' align='right' class='showtop' height='10' background='bar.jpg'>" strShowmem=strShowmem & "</td>" strShowmem=strShowmem & "</tr>" strShowmem=strShowmem & "<tr>" strShowmem=strShowmem & "<td rowspan ='2' width='64'>" if substrMem(3)="0" then strShowmem=strShowmem & "<img src='clock.gif' width='64' height='64'/>" intPlaysound=intPlaysound+1 else strShowmem=strShowmem & "<img src='icon64.gif' width='64' height='64'/>" end if strShowmem=strShowmem & "</td>" strShowmem=strShowmem & "<td style='font-weight :bolder;'>" strShowmem=strShowmem & "<font color=red>★</font> " & substrMem(1) & "(" & MemTime & ")" strShowmem=strShowmem & "</td>" strShowmem=strShowmem & "</tr>" strShowmem=strShowmem & "<tr>" strShowmem=strShowmem & "<td class='showtop'>" strShowmem=strShowmem & "<textarea cols='25' rows='2' readonly='readOnly' class='tastyle'>" strShowmem=strShowmem & replace(substrMem(2),"<br>",vbcrlf) strShowmem=strShowmem & "</textarea>" strShowmem=strShowmem & "</td>" strShowmem=strShowmem & "</tr>" strShowmem=strShowmem & "<tr> " strShowmem=strShowmem & "<td colspan='2' align='right' class='showtop'>" if substrMem(3)="0" then strShowmem=strShowmem & "<input type='button' value='知道' id='btnmemknow" & intI & "' name='btnmemknow" & intI & "' onclick='Memknow(" & intI & ")'/>" end if strShowmem=strShowmem & "<input type='button' value='删除' id='btnmemdel" & intI & "' name='btnmemdel" & intI & "' onclick='Memdel(" & intI & ")'/>" strShowmem=strShowmem & "<input type='button' value='关闭' id='btnmemclose" & intI & "' name='btnmemclose" & intI & "' onclick='Memclose(" & intI & ")'/>" strShowmem=strShowmem & "</td>" strShowmem=strShowmem & "</tr>" strShowmem=strShowmem & "</table>" end if next showmemdiv.innerHTML =strShowmem showmemdiv.style.display="block"end subsub Memknow(intIndex) dim substrMem substrMem=split(strMem(intIndex),",") substrMem(3)="1" strMem(intIndex)=join(substrMem,",") document.all("btnmemknow" & intIndex).style.visibility="hidden" WMemFile(1) getMeminfoend subsub Memdel(intIndex) if ubound(strMem)=0 then if intIndex=0 then WMemFile(0) else exit sub end if else if intIndex<>ubound(strMem) then dim loopI for loopI=intIndex to ubound(strMem)-1 strMem(loopI)=strmem(loopI+1) next end if redim Preserve strMem(ubound(strMem)-1) WMemFile(1) end if intMemcount=intMemcount-1 getMeminfo if showviewdiv.innerHTML<>"" and showviewdiv.style.display="block" then ShowMem end if end subsub WMemFile(intFlag) dim fs set fs=createobject("scripting.filesystemobject") select case intFlag case 0 if fs.FileExists(wFileName)=true then fs.DeleteFile(wFileName) end if case 1 dim intI dim strForW for intI=0 to Ubound(strMem) strForW=strForW & "&%" & left(strMem(intI),len(strMem(intI))-2) & "&%" & "*" next strForW=left(strForW,len(strForW)-1) dim WF set WF=fs.CreateTextFile(wFileName, True) WF.write strForW end selectend subsub Memclose(intIndex) dim substrMem substrMem=split(strMem(intIndex),",") substrMem(3)="1" substrMem(4)="0" strMem(intIndex)=join(substrMem,",") getMeminfo if showviewdiv.innerHTML<>"" and showviewdiv.style.display="block" then ShowMem end if end subsub getMeminfo() dim intDoneyes dim intDonenot intDoneyes=0 intDonenot=0 if intMemcount>0 then dim intI for intI=0 to ubound(strMem) dim substrMem substrMem=split(strMem(intI),",") if substrMem(3)="1" then intDoneyes=intDoneyes+1 next intDonenot=intMemcount-intDoneyes end if lblall.innerHTML =intMemcount lblDoneyes.innerHTML =intDoneyes lblDonenot.innerHTML =intdonenotend sub</script> </head><body onload="loadsys"> <div style="width:300px; height: 18px;vertical-align:bottom;" id="showtime" name="showtime" class="stylesystime"> </div> <div style="width:300px; height: 18px;vertical-align:bottom;" id="showmeminfo" name="showmeminfo" class="stylesystime"> 目前备忘总数:<label id="lblAll" name="lblAll"></label> 已处理:<label id="lblDoneyes" name="lblDoneyes"></label> 待处理:<label id="lblDonenot" name="lblDonenot"></label> </div> <div style="width: 300px; height: 18px;padding-top:0px;" id="menu" name="menu"> <table border="0" width="100%"> <tr> <td align ="left" width="80%"> <font color=white>[</font> <a href="#" onclick="ShowDiv(1)" class="menu">设置</a> <font color=white>]</font> <font color=white>[</font> <a href="#" onclick="ShowDiv(2)" class="menu">添加</a> <font color=white>]</font> <font color=white>[</font> <a href="#" onclick="ShowDiv(3)" class="menu">查看</a> <font color=white>]</font> <font color=white>[</font> <a href="#" onclick="ShowDiv(4)" class="menu">帮助</a> <font color=white>]</font> </td> <td align ="right"> <div style="width:40px; height:18px;text-align:left;padding-top:6px;visibility:hidden;font-size:12px;" id="menuclose" name="menuclose"> <font color=white>[</font> <a href="#" class="menu" onclick="closeMenu">关闭</a> <font color=white>]</font> </div> </td> </tr> </table> </div> <div style="width: 400px; height: 56px;color:White;display:none;" id="showsetdiv" name="showsetdiv"> <input id="ChkSet1" name="ChkSet1" type="checkbox" onclick="sysSet1" />显示中文时间<br /> <input id="ChkSet2" name="ChkSet2" type="checkbox" onclick="sysSet2" />播放声音 <div id="divset2" name="divset2" style="width: auto;color:red;display:inline;"> </div> <br /> <input id="ChkSet3" name="ChkSet3" type="checkbox" onclick="sysSet3" />显示上次关闭时未处理的备忘(即使已经超时) </div> <div style="width: 300px; height:auto;color:White;display:none;" id="showadddiv" name="showadddiv"> <table width="100%" border="0" class="viewtable"> <tr> <td width="40" align ="center">标题 </td> <td> <input id="txtMemTitle" name="txtMemTitle" type="text" class="inputtype" maxlength="10"/> </td> </tr> <tr> <td align ="center">时间 </td> <td> <input id="txtMemTime" name="txtMemTime" type="text" class="inputtype" maxlength="16"/> </td> </tr> <tr> <td align ="center" valign="top">内容 </td> <td> <textarea id="txtMemContent" name="txtMemContent" cols="25" rows="2" style="width:250px;"></textarea> </td> </tr> <tr> <td> <input type="button" id="btnAdd" name="btnAdd" onclick="AddMem" value="增加"/> </td> <td> <div style="width: 300px; height: 20px;text-align:left;padding-top:6px;" id="MemAddInfo" name="MemAddInfo"></div> </td> </tr> </table> </div> <div style="width: 300px; height: 56px;color:White;display:none;" id="showviewdiv" name="showviewdiv"> </div> <div style="width: 300px; height: 56px;color:White;display:none;" id="showhelpdiv" name="showhelpdiv"> <textarea style="border:none;color:white;background-color:transparent;width:300px;" rows="7" readonly="readOnly"> ★ 设置——备忘录系统设置播放声音:备忘到时,声音提示。默认声音为 Win$\media\notify.wav如果没有该文件,将不能选择。 ★ 增加——增加新的备忘录标题:最长10个字符;时间:格式如:2008-09-10 10:02;内容:最长50个字符,换行最好不超过2次。 ★ 查看——查看现在已有的备忘录:显示:将备忘显示在提示窗口;删除:删除备忘。 ★ 帮助——您现在看到的信息提供了本系统的操作说明。 ★ 备忘提示窗口知道:标记为处理,但不关闭提示窗口;关闭:标记为处理,并关闭提示窗口;删除:关闭备忘提示窗口,并删除备忘。 --------------------------- 感谢使用本备忘录系统! 详细说明请查看readme.txt! 希望能够对您有所帮助! --uruseibest --------------------------- </textarea> </div> <div style="width:300px; height:auto;color:White;display:none;" id="showmemdiv" name="showmemdiv"> </div></body></html>
使用到的几个图片文件:
bar.jpg
clock.gif icon64.gif
vbscript终于退出了舞台,真是太遗憾了。
阅读全文
0 0
- vbscript写的网页备忘录
- vbscript写的网页备忘录 后续
- 给妹妹写的备忘录
- 我写的Javascript/VBScript函数,
- 用VBScript写合并文本文件的脚本
- 用J2ME写一个简易的备忘录
- 用VBScript作连接数据库的动态网页
- 网页中javascript和vbscript共存的注意事项
- VBScript写上传FTP
- ASP中一个用VBScript写的随机数类
- 纯ASP(VBscript)写的全球IP地址搜索程序
- 写的全球IP地址搜纯ASP(VBscript)
- vbscript数组传入c#写的类库
- 利用VBScript打开指定网页
- JAVA相关网页备忘录
- javascript 写的表格拖拉功能 由VBSCRIPT转成,最后一段VBSCRIPT用于界面处理所以没有转
- 在网页中使用TTS技术的例子 & 备忘录
- 以后开始写博客,作为学习的备忘录
- C3P0(开源的数据库连接池)
- QT信号和槽机制的介绍
- JavaScript:排他思想、下拉菜单
- 使用wget下载Oracle 11g
- BinaryTree-递归遍历&建树--C语言
- vbscript写的网页备忘录
- 通过properties类 读取文件内容
- 【homework 二】JSP中include指令和include行为的区别(Java Web)
- TypeError: not all arguments converted during string formatting
- 背景图片加载不出问题的解决办法
- Spring Web Flow 简单实现
- 关于日期选择器和时间选择器的简单应用
- 自建短连接
- 记录一下以后好查 spring 设置注入 构造器注入