[url=#]
rs.movenext
if rs.eof then exit for
next
strlist=strlist&"</table>"
thelist.innerHTML=strlist
pagelist="第<select name='cpage' onchange=changeit2()>"
for j=1 to thepages
if j=intpage then
pagelist=pagelist&"<option value="&j&" selected>"&j&"</option>"
else
pagelist=pagelist&"<option value="&j&">"&j&"</option>"
end if
next
pagelist=pagelist&"</select>页"
fenye.innerHTML=pagelist
call changepage
else
thecounts.innerHTML="<font color='#ffff33'>对不起没有您要的信息</font>"
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("<html><head><scr"+"ipt>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();}</scr"+"ipt><meta http-equiv='Content-Type' content='text/html; charset=gb2312'><title>"+rs("title")+"</title><body style='margin:10px' bgcolor='#3a6ead'><table width='700' border='0' align='center' cellpadding='0' cellspacing='0'><tr><td><textarea rows='20' style='width:700; border:1px solid #808080; overflow:hidden;' onmouseover='this.style.posHeight=this.scrollHeight' onpropertychange='this.style.posHeight=this.scrollHeight' onload='this.style.posHeight=this.scrollHeight'>"+theopencontent+"</textarea><br><input type=button value='运行上面的代码[html]' onclick='runit()'> <input type=button value='保存' onclick='saveit()'></td></tr></table></body></html>")
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="<a href='#' onclick='changeit(1)'>首页</a> "
if cpage_v>1 then
cpage_value=cpage_value&"<a href='#' onclick='changeit("&cpage_v-1&")'>上一页</a> "
end if
if cpage_v<cpage_l and cpage_v>=1 then
cpage_value=cpage_value&"<a href='#' onclick='changeit("&cpage_v+1&")'>下一页</a> "
end if
cpage_value=cpage_value&"<a href='#' onclick='changeit("&cpage_l&")'>尾页</a> "
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
</script>
<body style="margin:0px; ">
<table width="98" height="10" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td></td>
</tr>
</table>
<span name="theadd" id="theadd" style="display:none">
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0" style="border:1px dotted #ffffff ">
<tr>
<td style="line-height:150%; ">类 别:
<input name="theclass" type="text" id="theclass" style="border:1px solid #808080;" size="10" maxlength="50">
标题:
<input name="thetitle" type="text" id="thetitle" size="40" maxlength="200">
<input type="button" name="add" value="添加" onClick="addnews">
<input type="button" name="edit" value="修改" onClick="editsave">
<input type="button" name="undo" value="取消" onClick="unadd">
<br>
添加内容:
<span class="style4">
<textarea name="content" rows="15" style="border:1px solid #808080; width:760; work-break:break-all; " ondblclick="content.style.posHeight=content.scrollHeight"></textarea>
</span> <br>
是否推荐:<input name="isgood" type="text" size="5">
<br> id值:
<input name="theid1" type="text" size="5"></td>
</tr>
</table>
</span><br>
<table width="760" height="47" border="0" align="center" cellpadding="0" cellspacing="0" style="border:1px dotted #ffffff;">
<tr>
<td height="23" align="center"><div align="left"><span class="style9">内容列表</span> [
<input type="button" value="添加信息" onClick="addnews">
] 类别:<span id="classlist"></span>
<input name="button" type="button" onClick="changeit(1)" value="载入">
<input type="button" onClick="addclass" value="添加"'>
<input type="button" onClick="delclass" value="删除"'>
<input type="button" onClick="editclass" value="编辑"'>
<input type="button" name="Submit" value="退出" onClick="quitscript"'>
<input name="searchstr" type="text" id="searchstr"' onfocus="searchstr.select()">
<input type="submit" name="Submit" value="搜"' onClick="searchits">
</div></td>
</tr>
<tr>
<td><hr align="center" width="80%" size="1" noshade style="border:1px solid #ffffff "></td>
</tr>
<tr>
<td align="center"><span id="fenyetop"></span></td>
</tr>
<tr>
<td><span id="thelist"></span></td>
</tr>
<tr>
<td align="center"><span id="thecounts"></span> <span id="dispage"></span><span id="fenye"></span></td>
</tr>
</table>
</body>
</html>
打包下载:jb51_hta(jb51.net).rar[/url]