2005/05/28 | 通知查看系统
类别(ASP) | 评论(0) | 阅读(148) | 发表于 15:45
接上回:

news_display.asp

<%
i=0
'建立记录变量来记录读取库中记录的条数。
set conn = server.createobject("adodb.connection")
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("news.mdb")
set rs = server.createobject("adodb.recordset")
'建立库连接
sql = "select * from news1 order by id desc"
'SQL语句,从数据表邮件列表中读出所有数据,并根据ID进行反向排列。
rs.Open sql,conn,1,3
'打开从库中读出的记录集。
response.Write "list="
'输出"list="这几个字符
while not rs.eof
'While 循环语句,这里是条件,当记录集没有空时,执行后边的语句。
news_title = rs("news_title")
news_file=rs("news_file")
news_publisher=rs("news_publisher")
news_publish_time=rs("news_publish_time")
'将当前记录中的"name" 赋值给变量news_title
response.Write news_title
response.Write "#"
response.Write news_file
response.Write "#"
response.Write news_publisher
response.Write "#"
response.Write news_publish_time
response.Write "#"
i=i+1
'记录条数。

rs.MoveNext
'到下一条记录
wend
'返回到“while”
rs.close
'关闭记录集
response.write "|"

response.write i
'打印条数。

set rs = nothing
set conn = nothing
%>



news_display.fla

主场景第一帧:

System.useCodepage =true
stop()
read=new LoadVars()
read.load("news_display.asp?"+random(1000))
read.onLoad=function(success){
if(success){
play()}
}
stop()

主场景第二帧:

list = read.list;
file://disp=list
countent = list.split("|");

temp = countent[0].split("#");
var temp_news_title= [];
var temp_news_file = [];
var temp_news_publisher= [];
var temp_news_publish_time= [];
for (var i = 0; i<countent[1]*4; i++) {
switch (i%4) {
case 0:
temp_news_title.push(temp[i]);
break;
case 1:
temp_news_file.push(temp[i])
break;
case 2:
temp_news_publisher.push(temp[i])
break;
case 3:
temp_news_publish_time.push(temp[i])
break;
}

}

delete temp;
file://myList.vScrollPolicy = "off";
for (var i = 0; i<countent[1]; i++) {
myD.addItem({新闻标题:temp_news_title[i], 具体内容:temp_news_file[i], 发布单位:temp_news_publisher[i],发布时间:temp_news_publish_time[i]});

}

delete countent;
form = new Object();
form.change = function(eventObj) {
getURL(eventObj.target.selectedItem.具体内容)
};
myD.addEventListener("change", form);
stop()


在主场景中拖入一DataGrid组件,并命名为myD。。。





10:53 | 固定链接 | 评论 (0) | 引用通告 (0) | 记录它 | Flash+ASP


固定链接 关闭

spaces.msn.com/members/xbzg/Blog/cns!1pSXEs0HKRbiWBiSFEkFo-MA!124.entry







通知发布系统

这几天为某单位做一网站,要用到通知发布系统,正好又看了老闪zjs35的相关日志,于是比葫芦画瓢做了一个。。。

news_add.asp

<%
userexist=0
news_title=Request.form("news_title")
news_file=Request.Form("news_file")
news_publisher=Request.Form("news_publisher")
news_publish_time=Request.Form("news_publish_time")
set conn = server.createobject("adodb.connection")
conn.open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("news.mdb")
set rs = server.createobject("adodb.recordset")
rs.open "news1",conn,1,3
while not rs.eof
'While 循环语句,这里是条件,当记录集没有空时,执行后边的语句。

if (news_title=rs("news_title") and news_file=rs("news_file") and news_publisher=rs("news_publisher") and news_publish_time=rs("news_publish_time")) then
response.Write "<p align=center>&nbsp;</p>"

response.Write "<P align=center><FONT color=black size=2>此通知已发布,请重新发布。。。</FONT></P>"
userexist=1
end if
rs.MoveNext
wend
if userexist=0 then
rs.addnew
rs("news_title") = news_title
rs("news_file")=news_file
rs("news_publisher")=news_publisher
rs("news_publish_time")=news_publish_time
rs.update
set rs = nothing
set conn = nothing
response.Write "<p align=center>&nbsp;</p>"

response.Write "<P align=center><FONT color=black size=2>提交成功,请返回。。。</FONT></P>"

end if



%>

<head>
<title></title>
</head>

<body bgcolor="#cccccc">

<p align="center">&nbsp;</p>
<p align="center"> </p>

<p align="center"><embed width="341" height="264" src="news_add_finished.swf" align="baseline" style="HEIGHT: 29px; WIDTH: 114px"></p></body></HTML>





news_add.fla

提交按钮AS:

on(release){
if(_root.news_title=="" or _root.news_title=="标题不能为空,请重新输入..." or _root.news_title=="请输入标题" ){
_root.news_title="标题不能为空,请重新输入..." }
else if(_root.news_file=="" or _root.news_file=="请输入文件名" or _root.news_file=="文件名不能为空..."){
_root.news_file="文件名不能为空..."}

else{
getURL("news_add.asp","","POST")
}


0

评论Comments

日志分类
首页[186]
Flash[84]
FMS[41]
AIR[2]
ASP[11]
作品区[12]
其他[36]