***********************************************************************
'*一直想做一个自己用来学习的东西,可是一直没有时间,本想用asp(用netbox)做的。,我一直
'*想学习程序,vb但没有时间学习,现在想用c#做一个,但没有什么时间,偶尔去官方找vbscript发现
'*这个不错的hta于是花了两三天的时间,做了一个这个,希望大家能喜欢。
'*Author: dxy(reterry)
'*version:1.0
'*QQ: 461478385
'*Email:douxy001@gmail.com
***********************************************************************
//-->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<hta:application
id="dxymdb"
scroll="yes"
singleinstance="yes"
border="thin"
windowstate="maximize"
icon="dxy.ico"
>
<title>我的第一个hta程序</title>
<style type="text/css">
<!--
BODY
{
scrollbar-face-color : #D8DBDF;
scrollbar-highlight-color : #FFFFFF;
scrollbar-shadow-color : #C1C6CC;
scrollbar-3dlight-color : #ABB1B3;
scrollbar-arrow-color : #7F8996;
scrollbar-track-color : #F8FAF9;
scrollbar-darkshadow-color : #ABB1B3;
}
body,td,th {
font-size: 10pt;
color: #FFFFFF;
}
body {
background-color: #3a6ead;
}
a {
font-size: 9pt;
color: #000000;
}
a:link {
text-decoration: none;
color: #FFFF33;
}
a:visited {
text-decoration: none;
color: #FFFF33;
}
a:hover {
text-decoration: none;
color: #FFffff;
}
a:active {
text-decoration: none;
}
.style4 {font-weight: bold}
.b {
border-bottom-width: 1px;
border-bottom-style: dashed;
border-bottom-color: #BFDFFF;
}
.style9 {color: #ffff33}
input {
font-size:12px;
}
-->
</style>
</head>
<script language="vbscript">
'加入智能显示信息条数
strComputer = "."
Set objWMIService = GetObject("Winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * From Win32_DesktopMonitor")
For Each objItem in colItems
thewidth = objItem.ScreenWidth
theheight = objItem.ScreenHeight
Next
'------------------智能结速-----
const adUserClient=3
sub window_onload()
dim conn
set conn=createobject("adodb.connection")
conn.open "provider=microsoft.jet.oledb.4.0;data source=db.mdb"
set rs=createobject("adodb.recordset")
rs.cursorlocation=adUserClient
sql="select * from theclass order by id desc"
rs.open sql,conn,1,1
rs.movefirst
strclasslist="<select onclick=changeclass() name=theclassname>"
strclasslist=strclasslist+"<option value="&chr(34)&chr(34)&">"
do until rs.eof
strclasslist=strclasslist&"<option value="&chr(34)&rs.fields.item("class_name")&chr(34)&">"&rs.fields.item("class_name")&"</option>"
rs.movenext
loop
strclasslist=strclasslist&"<option value='其它'>其它</option><option value='全部'>全部</option></select>"
classlist.innerHTML=strclasslist
end sub
sub changeclass()
theclass.value=theclassname.value
if theclass.value="全部" then
theclass.value=""
end if
end sub
sub addclass()
classname=inputbox("请输入你要添加的类别","添加类别")
if classname="" then
msgbox "添加的类别不能为空"
exit sub
else
dim conn
set conn=createobject("adodb.connection")
conn.open "provider=microsoft.jet.oledb.4.0;data source=db.mdb"
set rs=createobject("adodb.recordset")
rs.cursorlocation=adUserClient
//sqla="insert into class(class_name)values("&classname&")"
rs.open "theclass",conn,3,3
rs.addnew()
rs("class_name")=classname
rs.update
rs.close
conn.close
msgbox classname&"添加成功",0
end if
call window_onload
end sub
sub delclass()
if confirm("你真的要删除吗?") then
delclassname=theclassname.value
if delclassname="" then
msgbox "要删除的类别不能为空"
exit sub
else
dim conn
set conn=createobject("adodb.connection")
conn.open "provider=microsoft.jet.oledb.4.0;data source=db.mdb"
set rs=createobject("adodb.recordset")
rs.cursorlocation=adUserClient
sqld="delete from theclass where class_name="&chr(39)&delclassname&chr(39)
rs.open sqld,conn,3,3
msgbox chr(34)&delclassname&chr(34)&"删除成功",0
//rs.close
//conn.close
end if
call window_onload
end if
end sub
sub editclass()
theeditclass=theclassname.value
reditclass=inputbox("请输入你要更改后的类别名称","类别修改")
if theeditclass="" or reditclass="" then
exit sub
else
dim conn
set conn=createobject("adodb.connection")
conn.open "provider=microsoft.jet.oledb.4.0;data source=db.mdb"
set rs=createobject("adodb.recordset")
rs.cursorlocation=adUserClient
sqld="update theclass set class_name="&chr(39)&reditclass&chr(39)&" where class_name="&chr(39)&theeditclass&chr(39)
rs.open sqld,conn,3,3
msgbox chr(34)&theeditclass&"-->"&reditclass&chr(34)&"成功修改",0
call window_onload
rs.close
conn.close
end if
end sub
sub window_onUnload
on error resume next
rs.close
conn.close
end sub
sub quitscript
on error resume next
rs.close
conn.close
self.close
end sub
sub unadd()
theclass.value=""
thetitle.value=""
content.value=""
theadd.style.display="none"
end sub
sub addnews()
theadd.style.display="block"
add.disabled=false
theclass.value=theclassname.value
getclass=theclass.value
gettitle=thetitle.value
getcontent=content.value
getisgood=isgood.value
if getisgood="" then
getisgood=0
else
getidgood=1
end if
if getclass<>"" and getclass<>"全部" and gettitle<>"" and getcontent<>"" then
//msgbox gettitle&getcontent
dim conn
set conn=createobject("adodb.connection")
conn.open "provider=microsoft.jet.oledb.4.0;data source=db.mdb"
set rs=createobject("adodb.recordset")
rs.cursorlocation=adUserClient
rs.open "list",conn,3,3
rs.addnew()
rs("title")=gettitle
rs("class_name")=getclass
rs("content")=getcontent
rs("isgood")=getisgood
rs.update
msgbox "恭喜,数据添加成功"
theclass.value=""
thetitle.value=""
content.value=""
end if
//rs.close
//conn.close
end sub
sub searchits()
thesearch=sea

