白开心
IT博客
::
首页
:: ::
联系
::
聚合
::
管理
::
9 随笔 :: 76 文章 :: 28 评论 :: 0 Trackbacks
<
2024年12月
>
日
一
二
三
四
五
六
24
25
26
27
28
29
30
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1
2
3
4
公告
独坐在路边街角,冷风吹醒,默默地伴着我的孤影。
常用链接
我的随笔
我的评论
我参与的随笔
留言簿
(12)
给我留言
查看公开留言
查看私人留言
文章分类
.Net(学习ing...)(39)
(rss)
Asp+vbScript(14)
(rss)
JavaScript(14)
(rss)
T-SQL(8)
(rss)
经典收藏(8)
(rss)
设计模式
(rss)
文章档案
2013年4月 (1)
2013年3月 (1)
2012年7月 (1)
2012年4月 (1)
2011年10月 (1)
2011年8月 (1)
2011年3月 (1)
2011年2月 (1)
2011年1月 (1)
2010年9月 (1)
2010年6月 (1)
2010年4月 (2)
2010年1月 (1)
2009年11月 (1)
2009年10月 (6)
2009年9月 (3)
2009年8月 (2)
2009年5月 (1)
2008年10月 (2)
2008年9月 (2)
2008年7月 (2)
2008年6月 (1)
2008年3月 (1)
2008年2月 (1)
2008年1月 (1)
2007年12月 (5)
2007年11月 (4)
2007年10月 (2)
2007年9月 (2)
2007年7月 (1)
2007年6月 (2)
2007年4月 (2)
2007年1月 (1)
2006年12月 (1)
2006年11月 (2)
2006年8月 (1)
2006年7月 (1)
2006年5月 (2)
2006年4月 (1)
2006年2月 (1)
2006年1月 (1)
2005年12月 (10)
相册
PhotoShop Study For HuangHuaXiang
我的相册
收藏夹
.NET(1)
(rss)
其他类别
(rss)
搜索
最新评论
1. re: JQUERY的表单异步提交[未登录]
1111111
--111
2. re: JQUERY的表单异步提交
eqedqedasd
--123
3. re: 委托和匿名函数
评论内容较长,点击标题查看
--bracelet shopping
4. re: 递归查询
您好!你的在我这里怎么执行不了啊!
--小陈
5. re: JS操作Xml的相关方法[未登录]
不能保丰到服务器上?
--11
阅读排行榜
1. 窦房折返性心动过速(928)
2. ∷∷∷∷男人感悟一百条∷∷∷∷(710)
3. 人生致命的八个经典问题(657)
4. 秋天不回来(570)
5. 圣诞(467)
评论排行榜
1. 圣诞(0)
2. 人生致命的八个经典问题(0)
3. ∷∷∷∷男人感悟一百条∷∷∷∷(0)
4. 窦房折返性心动过速(0)
5. 秋天不回来(0)
静态新闻发布(05_3)
<!
DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
" http://www.w3.org/TR/html4/loose.dtd "
>
<
html
>
<
head
>
<
meta
http-equiv
="Content-Type"
content
="text/html; charset=gb2312"
>
<
title
>
新闻发布****文件生成版本
</
title
>
<
script
language
="javascript"
>
function
checkdel(id)
{
if
(
!
confirm(
"
确认删除此新闻内容吗?
"
))
return
(
false
);
myform.txtid.value
=
id;
myform.txtcmd.value
=
"
del
"
;
myform.submit();
}
function
checkshow(str)
{
myform.txtid.value
=
str;
myform.txtcmd.value
=
"
show
"
;
myform.submit();
}
function
checkedit()
{
if
(myform.txtTitle.value
==
""
)
{
alert(
"
新闻标题不可以空!
"
);
myform.txtTitle.focus();
return
(
false
);
}
if
(myform.txtPageSize.value
==
""
)
{
alert(
"
请填写每页显示字符数!
"
);
myform.txtPageSize.focus();
return
(
false
);
}
if
(isNaN(myform.txtPageSize.value))
{
alert(
"
每页显示字符数请一定填写数字
"
);
myform.txtPageSize.focus();
return
(
false
);
}
if
(myform.txtContent.value
==
""
)
{
alert(
"
新闻内容不可以空!
"
);
myform.txtContent.focus();
return
(
false
);
}
myform.txtcmd.value
=
"
edit
"
;
myform.submit();
}
function
checkadd()
{
if
(myform.txtTitle.value
==
""
)
{
alert(
"
新闻标题不可以空!
"
);
myform.txtTitle.focus();
return
(
false
);
}
if
(myform.txtPageSize.value
==
""
)
{
alert(
"
请填写每页显示字符数!
"
);
myform.txtPageSize.focus();
return
(
false
);
}
if
(isNaN(myform.txtPageSize.value))
{
alert(
"
每页显示字符数请一定填写数字
"
);
myform.txtPageSize.focus();
return
(
false
);
}
if
(myform.txtContent.value
==
""
)
{
alert(
"
新闻内容不可以空!
"
);
myform.txtContent.focus();
return
(
false
);
}
myform.txtcmd.value
=
"
add
"
;
myform.submit();
}
function
checkchangepage()
{
myform.txtcmd.value
=
"
changepage
"
;
myform.submit();
}
function
checkgo(page)
{
myform.nextPage.value
=
page;
myform.txtcmd.value
=
"
page
"
;
myform.submit();
}
function
checkNum()
{
if
(isNaN(myform.txtPageSize.value))
{
alert(
"
每页显示多少数据请填写数字
"
);
myform.txtPageSize.focus();
return
(
false
);
}
}
</
script
>
<
style
type
="text/css"
>
<!--
body
{
}
{
font-size
:
12px
;
}
-->
</
style
>
</
head
>
<
body
>
<!--
#include file="config.asp"
-->
<%
on
error
resume
next
Dim
ShowTitle,ShowContent,ShowFlag
Dim
cmd,rid,iPage
rKey
=
trim
(request(
"
SelKey
"
))
rPage
=
request(
"
SelPage
"
)
iPage
=
request(
"
currentPage
"
)
nextPage
=
request(
"
nextPage
"
)
totalPage
=
request(
"
totalPage
"
)
cmd
=
trim
(request(
"
txtcmd
"
))
rid
=
trim
(request(
"
txtid
"
))
rTitle
=
trim
(request(
"
txtTitle
"
))
rTitle
=
replace
(rTitle,
"
'
"
,
"
''
"
)
rPageSize
=
cint
(request(
"
txtPageSize
"
))
rSize
=
cint
(request(
"
txtSize
"
))
if
rSize
=
0
then
rSize
=
18
if
rPageSize
=
""
then
rPageSize
=
800
rFlag
=
trim
(request(
"
txtFlag
"
))
rContent
=
trim
(request(
"
txtContent
"
))
rContent
=
replace
(rContent,vbcrlf,
"
|
"
)
Select
Case
cmd
Case
"
add
"
call
HtmlAdd
Case
"
show
"
call
ShowData
Case
"
edit
"
call
HtmlEdit
Case
"
del
"
call
deldata
Case
"
page
"
call
Page
Case
"
changepage
"
iPage
=
cint
(rPage)
Case
else
iPage
=
1
End
Select
Sub
Page
iPage
=
cint
(iPage)
+
cint
(nextPage)
if
iPage
>
cint
(totalPage)
then
iPage
=
cint
(totalPage)
if
iPage
<
1
then
iPage
=
1
End Sub
Sub
ShowData
sql
=
"
Select * from html where flag in (select flag from html where id=
"
&
rid
&
"
)
"
rs.Open sql,cn,
1
,
3
ShowTitle
=
trim
(rs(
"
title
"
))
ShowFlag
=
trim
(rs(
"
flag
"
))
'
flag是多个文件对应一个标题的唯一标志,这里写出方便修改时记住哪个文件
dim
fs
set
fs
=
server.CreateObject(
"
scripting.filesystemobject
"
)
For
i
=
1
to
rs.RecordCount
filepath
=
server.MapPath(
"
HtmlFile/
"
&
trim
(rs(
"
src
"
))
&
""
)
set
txt
=
fs.OpenTextFile(filepath)
'
读取内容
Content
=
txt.readline
ShowContent
=
ShowContent
&
mid
(Content,
instr
(Content,
"
<!--ContentStart-->
"
)
+
19
,
instr
(Content,
"
<!--ContentEnd-->
"
)
-
instr
(Content,
"
<!--ContentStart-->
"
)
-
19
)
txt.close
rs.movenext
Next
set
fs
=
nothing
rs.close
ShowContent
=
replace
(ShowContent,
"
<br>
"
,vbcrlf)
End Sub
Sub
deldata
rs.Open
"
Select src from html where flag in(select flag from html where id=
"
&
rid
&
"
)
"
,cn,
1
,
3
if
rs.RecordCount
>
0
then
set
fs
=
server.CreateObject(
"
scripting.filesystemobject
"
)
for
i
=
1
to
rs.RecordCount
FileName
=
trim
(rs(
"
src
"
))
if
fs.FileExists(server.mappath(
"
HtmlFile
"
&
"
/
"
&
FileName))
then
fs.DeleteFile(server.mappath(
"
HtmlFile
"
&
"
/
"
&
FileName))
end
if
rs.movenext
next
set
fs
=
nothing
end
if
rs.close
sql
=
"
delete from html where flag in(select flag from html where id=
"
&
rid
&
"
)
"
cn.execute sql
End Sub
Sub
HtmlEdit
'
此程序主要用来删除原有数据,再调用生成新文件
rs.Open
"
select src from html where flag='
"
&
rFlag
&
"
'
"
,cn,
1
,
3
if
rs.RecordCount
>
0
then
set
fs
=
server.CreateObject(
"
scripting.filesystemobject
"
)
for
i
=
1
to
rs.RecordCount
FileName
=
trim
(rs(
"
src
"
))
if
fs.FileExists(server.mappath(
"
HtmlFile
"
&
"
/
"
&
FileName))
then
fs.DeleteFile(server.mappath(
"
HtmlFile
"
&
"
/
"
&
FileName))
end
if
rs.movenext
next
set
fs
=
nothing
end
if
rs.close
sql
=
"
delete from html where flag='
"
&
rFlag
&
"
'
"
cn.execute sql
Call
HtmlAdd
End Sub
Sub
HtmlAdd
'
未使用模板生成HTML页面,有时间考虑修改过来
dim
fs,files,filepath,Content
if
len
(rContent)
<
rPageSize
then
'
这里得到页面数,当然也可以写成函数形式
rPageCount
=
1
else
iNum
=
len
(rContent)
/
rPageSize
if
instr
(iNum,
"
.
"
)
=
""
then
rPageCount
=
iNum
else
rPageCount
=
(
round
(iNum,
0
)
+
1
)
end
if
end
if
dim
varry()
HtmlName
=
year
(
now
())
&
month
(
now
())
&
day
(
now
())
&
hour
(
now
())
&
minute
(
now
())
&
second
(
now
())
'
取得文件名的主要部分
redim
varry(
cint
(rPageCount))
For
i
=
0
to
(rPageCount
-
1
)
'
首先自动生成所有的文件名,生成文件时用此处文件名,记录文件名相同的部分,便于编辑修改
varry(i)
=
HtmlName
&
i
&
"
.shtml
"
Sql
=
"
insert into html(src,title,AddDate,flag) values('
"
&
varry(i)
&
"
','
"
&
rTitle
&
"
','
"
&
date
()
&
"
','
"
&
HtmlName
&
"
')
"
cn.execute Sql
Next
set
fs
=
server.CreateObject(
"
scripting.filesystemobject
"
)
'
生成文件对象
For
i
=
0
to
(rPageCount
-
1
)
Content
=
""
Content
=
Content
&
"
<script language=vbscript src=../Counter.Asp?Page=
"
&
varry(i)
&
"
></script>
"
Content
=
Content
&
"
<!--#include file=top.shtml-->
"
Content
=
Content
&
"
<table border=0 align=center cellpadding=0 cellspacing=0 width='70%'>
"
Content
=
Content
&
"
<tr><td align=center><font size=3>
"
&
replace
(rTitle,
"
''
"
,
"
'
"
)
&
"
</font></td></tr>
"
Content
=
Content
&
"
<tr><td height=3></td></tr>
"
Content
=
Content
&
"
<tr><td align=center>发表日期:
"
&
date
()
&
"
,阅读次数:<!--ReadNum-->0<!--End ReadNum--><!--该页面中阅读次数,热点新闻按点击率,最新新闻考虑使用iframe--></td>
"
Content
=
Content
&
"
<tr><td height=9></td></tr>
"
Content
=
Content
&
"
<tr><td> <!--ContentStart-->
"
&
Replace
(
mid
(rContent,(i
*
rPageSize
+
1
),rPageSize),
"
|
"
,
"
<br>
"
)
&
"
<!--ContentEnd--></td></tr>
"
if
rPageCount
>
1
then
'
分页操作
Content
=
Content
&
"
<tr><td height=10></td></tr>
"
Content
=
Content
&
"
<tr><td align=right>
"
Content
=
Content
&
"
当前
"
&
i
+
1
&
"
/
"
&
rPageCount
&
"
页
"
if
i
>
0
and
i
<
rPageCount
then
Content
=
Content
&
"
<a href=
"
&
varry(
0
)
&
"
>[第一页]</a>
"
Content
=
Content
&
"
<a href=
"
&
varry(i
-
1
)
&
"
>[上一页]</a>
"
end
if
if
rPageCount
>
0
and
i
<
(rPageCount
-
1
)
then
Content
=
Content
&
"
<a href=
"
&
varry(i
+
1
)
&
"
>[下一页]</a>
"
Content
=
Content
&
"
<a href=
"
&
varry(rPageCount
-
1
)
&
"
>[最末页]</a>
"
end
if
Content
=
Content
&
"
</td></tr>
"
end
if
Content
=
Content
&
"
<tr><td height=15></td></tr>
"
Content
=
Content
&
"
<tr><td align=center><a href='javascript:window.close();'>关闭窗口</a></td></tr>
"
Content
=
Content
&
"
<!-- #include file=bot.shtml -->
"
filepath
=
server.mappath(
"
HtmlFile
"
)
&
"
/
"
&
varry(i)
'
文件名及路径
set
files
=
fs.createtextfile(filepath,
true
)
'
创建文件
files.writeline(Content)
'
写入信息
files.close
Next
set
fs
=
nothing
End Sub
sql
=
"
Select * from html where id in(select min(id) from html group by flag) and title like '%
"
&
rKey
&
"
%' order by id desc
"
%>
<
form
action
="HtmlList.asp"
method
="post"
name
="myform"
>
<
table
border
="1"
style
="border-collapse:collapse"
width
="71%"
align
="center"
>
<
tr
>
<
td
width
="26%"
align
="right"
>
新闻标题:
</
td
>
<
td
width
="74%"
align
="left"
>
<
input
type
="text"
name
="txtTitle"
size
="50"
maxlength
="90"
value
="<%=ShowTitle%>"
></
td
>
</
tr
>
<
tr
>
<
td
align
="right"
>
每页显示字符数:
</
td
>
<
td
align
="left"
>
<
input
type
="text"
size
="4"
maxlength
="5"
name
="txtPageSize"
value
="800"
></
td
>
</
tr
>
<
tr
>
<
td
align
="right"
>
新闻标题:
</
td
>
<
td
align
="left"
>
<
textarea
name
="txtContent"
cols
="70"
rows
="16"
>
<%
=
ShowContent
%>
</
textarea
></
td
>
</
tr
>
<
tr
><
td
align
="center"
colspan
="2"
>
<%
if
cmd
=
"
show
"
then
%>
<
input
type
="button"
name
="submit1"
value
="修改"
onClick
="return checkedit();"
>
<%
else
%>
<
input
type
="button"
name
="submit2"
value
="新增"
onClick
="return checkadd();"
>
<%
end
if
%>
<
input
type
="reset"
name
="reset1"
value
="重置"
>
</
tr
>
</
table
>
<%
rs.Open sql,cn,
1
,
3
rs.PageSize
=
int
(rSize)
response.Write
"
<table border=1 style='border-collapse:collapse' width='70%' align=center>
"
response.Write
"
<tr><td align=right colspan=3>
"
response.Write
"
搜索:<input type=text name=SelKey maxlength=90 size=15 value='
"
&
rKey
&
"
'> <input type=button value='搜索' onClick='myform.submit();'>
"
_
&
"
当前:
"
&
iPage
&
"
/
"
&
rs.PageCount
&
"
页 每页<input type=text name=txtSize value='
"
&
rSize
&
"
' size=3 maxlength=4 onChange='checkNum();'>条
"
_
&
"
<a href='#' onClick=checkgo(-1);>上一页</a> || <a href='#' onClick=checkgo(1);>下一页</a>
"
_
&
"
转向<select name=SelPage onChange='checkchangepage();'>
"
If
rs.PageCount
>
0
then
for
PageNum
=
1
to
rs.PageCount
response.Write
"
<option value=
"
&
PageNum
&
""
if
trim
(iPage)
=
trim
(PageNum)
then
response.Write
"
selected
"
response.Write
"
>第
"
&
PageNum
&
"
页</option>
"
Next
Else
response.Write
"
<option value=''>无分页</option>
"
End
if
response.Write
"
</td></tr>
"
response.Write
"
<tr>
"
response.Write
"
<td align=center>ID号</td>
"
response.Write
"
<td align=center>文章标题</td>
"
response.Write
"
<td align=center>相关操作</td>
"
response.Write
"
</tr>
"
if
rs.RecordCount
>
0
then
rs.absolutepage
=
iPage
for
i
=
1
to
rs.PageSize
if
rs.eof
then
exit
for
response.Write
"
<tr><td align=center>
"
&
trim
(rs(
"
id
"
))
response.Write
"
</td><td>
"
response.Write
"
<a href='HtmlFile/
"
&
trim
(rs(
"
src
"
))
&
"
' target='_blank'>
"
&
trim
(rs(
"
title
"
))
&
"
</a>
"
&
rs(
"
AddDate
"
)
response.Write
"
</td>
"
response.Write
"
<td align=center><a href='#' onClick='return checkdel(
"
&
trim
(rs(
"
id
"
))
&
"
);'>删除</a>
"
response.Write
"
<a href='#' onClick='return checkshow(
"
&
trim
(rs(
"
id
"
))
&
"
)'>修改</a>
"
response.Write
"
</td></tr>
"
rs.movenext
next
end
if
response.Write
"
</table>
"
%>
<
input
type
="hidden"
name
="currentPage"
value
="<%=iPage%>"
>
<
input
type
="hidden"
name
="nextPage"
value
=""
>
<
input
type
="hidden"
name
="totalPage"
value
="<%=rs.PageCount%>"
>
<
input
type
="hidden"
name
="txtid"
value
="<%=rid%>"
>
<
input
type
="hidden"
name
="txtFlag"
value
="<%=ShowFlag%>"
>
<
input
type
="hidden"
name
="txtcmd"
value
=""
>
</
form
>
<%
rs.close
Call
EndConnection
%>
</
body
>
</
html
>
posted on 2005-12-11 22:17
白开心
阅读(283)
评论(0)
编辑
收藏
引用
所属分类:
Asp+vbScript
只有注册用户
登录
后才能发表评论。
Powered by:
IT博客
Copyright © 白开心