个人学习之作 hta[原创]

随心笔谈2年前发布 编辑
158 0
🌐 经济型:买域名、轻量云服务器、用途:游戏 网站等 《腾讯云》特点:特价机便宜 适合初学者用 点我优惠购买
🚀 拓展型:买域名、轻量云服务器、用途:游戏 网站等 《阿里云》特点:中档服务器便宜 域名备案事多 点我优惠购买
🛡️ 稳定型:买域名、轻量云服务器、用途:游戏 网站等 《西部数码》 特点:比上两家略贵但是稳定性超好事也少 点我优惠购买

***********************************************************************

‘*一直想做一个自己用来学习的东西,可是一直没有时间,本想用asp(用netbox)做的。,我一直

‘*想学习程序,vb但没有时间学习,现在想用c#做一个,但没有什么时间,偶尔去官方找vbscript发现

‘*这个不错的hta于是花了两三天的时间,做了一个这个,希望大家能喜欢。

‘*Author: dxy(reterry)

‘*version:1.0

‘*QQ: 461478385

‘*Email:douxy001@gmail.com

***********************************************************************

//–>

     id=”dxymdb”

  scroll=”yes”

  singleinstance=”yes”

border=”thin”

  windowstate=”maximize”

icon=”dxy.ico”

>

我的第一个hta程序

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;

}

–>

‘加入智能显示信息条数

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=”

strclasslist=strclasslist+”

do until rs.eof

strclasslist=strclasslist&”

rs.movenext

loop

strclasslist=strclasslist&”

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=searchstr.value

‘if thesearch<>”” then

‘theclassname.value=””

‘end if

call changeit(1)

end sub

sub changeit(thenum)

theclass.value=theclassname.value

thename=theclassname.value

thesearch=searchstr.value

‘if thename<>”” then searchstr.value=””

thelist.innerHTML=””

thecounts.innerHTML=””

if thename<>”” or thesearch<>”” then

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

if thesearch=”” then

  if thename=”全部” then

  sql=”select id,class_name,title,enter_time from list order by id desc”

  else

  sql=”select id,class_name,title,enter_time from list where class_name='”&thename&”‘ order by id desc”

  end if

else

  if thename=”” then

  sql=”select distinct id,class_name,title,enter_time from list where (title like ‘%”&thesearch&”%’ or content like ‘%”&thesearch&”%’ or class_name like ‘%”&thesearch&”%’)”

  else

sql=”select distinct id,class_name,title,enter_time from list where (title like ‘%”&thesearch&”%’ or content like ‘%”&thesearch&”%’ or class_name like ‘%”&thesearch&”%’) and class_name='”&thename&”‘”

  end if

end if

rs.open sql,conn,1,1

page=trim(thenum)

if page<>”” then page=cint(page)

pre=true

last=true

if not rs.eof then

if theheight=600 then

maxperpage=20

elseif theheight>600 then

maxperpage=28

else

maxperpage=20

end if

rs.pagesize=maxperpage

thepages=rs.pagecount

thecount=rs.recordcount

if page=”” and page<1 then

intpage=1

pre=false

else

   if page>thepages then

     intpage=thepages

  last=false

  else

    intpage=cint(page)

 end if

end if

themovenum=(intpage-1)*maxperpage

thecounts.innerHTML=”共有“&thecount&”条信息[“&maxperpage&”条/页 共“&thepages&”页 当前第“&page&”页]”

rs.movefirst

if (intpage-1)*maxperpage

dim bookmark

bookmark=rs.bookmark

rs.move themovenum

end if

strlist=”

for i=1 to maxperpage

if rs.eof then exit for

strlist=strlist&”[“&rs(“class_name”)&”] “&rs(“title”)&”  “&rs(“enter_time”)&”  查看 修改 删除

rs.movenext

if rs.eof then exit for

next

strlist=strlist&””

thelist.innerHTML=strlist

pagelist=”第

for j=1 to thepages

if j=intpage then

pagelist=pagelist&”

else

pagelist=pagelist&”

end if

next

pagelist=pagelist&”页”

fenye.innerHTML=pagelist

call changepage

else

thecounts.innerHTML=”对不起没有您要的信息

end if

end if

//rs.close

//conn.close

end sub

sub changeit2()

thenum=cpage.value

call changeit(thenum)

end sub

sub openthecontent(id)

theid=id

if id<>”” then

id=cint(id)

end if

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 list where id=”&id&””

rs.open sql,conn,1,1

if not rs.eof then

theopencontent=rs(“content”)

theopencontent=replace(theopencontent,”<“,”<“)

theopencontent=replace(theopencontent,”>”,”>”)

set diswindow=window.open(“about:blank”,”diswindow”)

diswindow.document.body.style.fontSize=”12px”

diswindow.focus()

diswindow.document.write(“function saveit(){strDesktop=’C:\\Documents and Settings\\Administrator\\桌面’;var code=event.srcElement.parentElement.children[0].value;var objfso=new ActiveXObject(‘Scripting.FileSystemObject’);var strname=prompt(‘请输入文件名和路’,strDesktop+’\\temp.vbs’);if(strname!=”){var objfile=objfso.CreateTextFile(strname,2,true);objfile.Write(code);objfile.Close();}}function runit(){var code=event.srcElement.parentElement.children[0].value;var newwin=window.open(”);newwin.opener=null;newwin.document.write(code);newwin.document.close();}
“+rs(“title”)+”

“)

diswindow.focus()

diswindow.document.close()

end if

end sub

sub delthecontent(strid)

if confirm(“你真的要删除吗?”) then

id=strid

if id<>”” then

id=cint(id)

end if

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=”delete from list where id=”&id&””

rs.open sql,conn,3,3

msgbox “成功删除”

else

exit sub

end if

end sub

sub changepage()

cpage_l=cint(cpage.length)

cpage_v=cint(cpage.value)

cpage_value=”首页  “

if cpage_v>1 then

cpage_value=cpage_value&”上一页  “

end if

if cpage_v=1 then

cpage_value=cpage_value&”下一页  “

end if

cpage_value=cpage_value&”尾页  “

dispage.innerHTML=cpage_value

end sub

sub editnews(strid)

theadd.style.display=”block”

id=strid

if id<>”” then

id=cint(id)

end if

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 list where id=”&id&””

rs.open sql,conn,1,1

if not rs.eof then

titlee=rs(“title”)

contente=rs(“content”)

classname=rs(“class_name”)

end if

theclassname.value=classname

thetitle.value=titlee

content.value=contente

theid1.value=id

add.disabled=true

end sub

sub editsave()

id=theid1.value

edittitle=thetitle.value

editcontent=content.value

classname=theclass.value

if id<>”” then

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 id,class_name,title,content from list where id=”&id&””

rs.open sql,conn,3,3

rs(“class_name”)=classname

rs(“title”)=edittitle

rs(“content”)=editcontent

rs.update

if err.number=0 then

msgbox(“数据修改成功”)

end if

end if

theid1.value=””

thetitle.value=””

content.value=””

‘theclassname.value=””

theclass.value=””

theadd.style.display=”none”

add.disabled=false

call changeit2()

end sub

    类    别:

      标题:

      添加内容:

      是否推荐:

   id值:   

内容列表 [

      ] 类别:

</html>

© 版权声明

相关文章