首页 > 开发 > HTML > 正文

hta编写的消费记录程序

2020-01-29 17:23:27
字体:
来源:转载
供稿:网友
将代码复制粘贴到一文本文档中,然后保存,并将该文件后缀名改为:hta,双击即可运行。
代码如下:
<!--////////程序说明/////////====
程序名称:消费记录Ver1.1(20070808-20070811).hta
使用说明:将代码复制粘贴到一文本文档中,然后保存,并将该文件后缀名改为:hta,双击即可运行。
作者说明:youxi01,,,版权没有,欢迎盗版!!///////////-->
<!--///////设置题头,编码方式//////-->
<TITLE>消费记录程序</TITLE>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312"/>
<!--///////hta标志//////-->
<HTA:APPLICATION
SCROLL="no"
CAPTION="yes"
SYSMENU="yes"/>
<!--///////控制程序部分//////-->
<script language="vbscript">
totalMoney=0 '总消费额
index=-1 '初始化checkbox控件ID序号;
flag=0 '定义文件是否改动的标志
set fso=createobject("scripting.filesystemobject")
'///////////////////文件载入时,读取配置文件,定义自身大小、位置////////
Sub Window_onLoad
if not (fso.fileexists("consume.ini")) then '不存在配置文件则创建;
fso.createtextfile("consume.ini").close
end if
window.resizeTo 638,495 '设置自身大小、位置;
window.moveTo 200,100
addRow 0,"hoho","2007-1-1","星期二" '先添加一个行。自己都搞不明白,反正用来处理bug;
document.all.namedItem("mytable").rows(1).style.display="none" '设置这行不可见;
addRow 0,"hoho","2007-1-1","星期二" '再添加一个行。自己都搞不明白,反正用来处理bug;
document.all.namedItem("mytable").rows(2).style.display="none" '设置这行不可见;
readFile("consume.ini")
End Sub
'//////////////////读取文件//////////////////
Function readFile(filename)
set file=fso.opentextfile(filename,1,1)
do while file.atendofline<>true '读文件一直到文件尾部
str=split(file.readline,"#") '按#标志分割没行(总共有四个这种标志)
addRow str(1),str(2),str(3),str(4) '添加五个单元格,内容分别为....
loop
End Function
'////////////////添加表行,单元格///////////
Function addRow(cnum,ctype,cdate,cday)
index=index+1 '序号自加1
set objTable=document.all.namedItem("mytable") '根据ID获取对象表格
set newrow = objTable.insertRow() '插入一行
newrow.className="row_add" '设置该行的样式;
newrow.onmouseover=getRef("change_bgcolor")
newrow.onmouseout=getRef("back_bgcolor")
newrow.onclick=getRef("chooseOBJ")
var="#"&cnum&"#"&ctype&"#"&cdate&"#"&cday
str=split(var,"#")
str(0)="<input type=checkbox id='delcheck'&index>"
for i=0 to 4
set newcell=newrow.insertCell() '插入单元格,并设置单元格的值;
newcell.innerhtml=str(i)
next
totalMoney=totalMoney+clng(cnum) '设置总消费额的值,并定义显示;
consume.innerHTML="消费总额:"&totalMoney&"元"
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表