代码如下:
<!doctype html public -//w3c//dtd html 4.01 transitional//en>
<html>
<head>
<title>package file v0.1</title>
<meta http-equiv=content-type content="text/html; charset=gbk"'on error resume next
'//创建xmlhttp对象
set oreq = createobject(msxml2.xmlhttp)
oreq.open get,file:\\ & filename,false
oreq.send
ff = oreq.responsebody
dim u,s,kk
u = lenb(ff)
redim kk(u-1)
for i=0 to u-1
s = hex(ascb(midb(ff,i+1,1)))
if len(s)<2 then
s = 0 & s
end if
'kk = kk & s
kk(i) = s
next
make filename,join(kk,)
else
document.getelementbyid(srcfile).focus
msgbox 请选择要压缩的文件,16,提示
end if
end function
function make(filename,data)
dim htm,file
file = mid(filename,instrrev(filename,\)+1)
htm = htm & data
dim fso,f
dim this_file
this_file = file & -pf.htm
set fso = createobject(scripting.filesystemobject)
set f = fso.opentextfile(this_file, 2, true)
f.write htm
msgbox 生成文件 & this_file & 成功!,64,生成
end function
</script>
</head>
<body marginleft=0 marginright=0 onload=window.resizeto 389,145 >
请选择文件:<input type=file id=srcfile style=width:260px;>[br][br]
<input type=button value= 转换 onclick=transfert> <input type=button value= 关闭 onclick=window.close>
</body>
</html>