news.asp
上传用户:jisenq
上传日期:2014-06-29
资源大小:7216k
文件大小:6k
源码类别:

数据库编程

开发平台:

ASP/ASPX

  1. <% Option Explicit %>
  2. <!--#include file="../../FS_Inc/Const.asp" -->
  3. <!--#include file="../../FS_InterFace/MF_Function.asp" -->
  4. <!--#include file="../../FS_Inc/Function.asp" -->
  5. <%
  6. on error resume next
  7. Dim Conn,User_Conn,NewsRs,listnum,page,j,i,nn,n,pagename
  8. MF_Default_Conn
  9. MF_User_Conn
  10. MF_Session_TF
  11. Set NewsRs=Server.CreateObject(G_FS_RS)
  12. NewsRs.open "select NewsID,title,addtime,groupid,newspoint,isLock from FS_ME_News order by addtime desc",User_Conn,1,3
  13. pagename="news.asp?"
  14. if NewsRs.eof and NewsRs.bof Then
  15. else
  16. listnum=20
  17. NewsRs.pagesize=listnum
  18. page=Request("page")
  19. if (page-NewsRs.pagecount) > 0 then
  20. page=NewsRs.pagecount
  21. elseif page = "" or page < 1 then
  22. page = 1
  23. end if
  24. NewsRs.absolutepage=page
  25. '编号的实现
  26. j=NewsRs.recordcount
  27. j=j-(page-1)*listnum
  28. i=0
  29. nn=request("page")
  30. if nn="" then
  31. n=0
  32. else
  33. nn=nn-1
  34. n=listnum*nn
  35. end if
  36. end if
  37. %>
  38. <html xmlns="http://www.w3.org/1999/xhtml">
  39. <HEAD>
  40. <TITLE>FoosunCMS</TITLE>
  41. <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=gb2312">
  42. <script language="JavaScript" type="text/JavaScript">
  43. <!--
  44. function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  45.   if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
  46.     document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  47.   else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
  48. }
  49. MM_reloadPage(true);
  50. //-->
  51. var request=true;
  52. var result;
  53. try
  54. {
  55. request=new XMLHttpRequest();
  56. }catch(trymicrosoft)
  57. {
  58. try
  59. {
  60. request=new ActiveXObject("Msxml2.XMLHTTP")
  61. }catch(othermicrosoft)
  62. {
  63. try
  64. {
  65. request=new ActiveXObject("Microsoft.XMLHTTP")
  66. }catch(filed)
  67. {
  68. request=false;
  69. }
  70. }
  71. }
  72. if(!request) alert("Error initializing XMLHttpRequest!");
  73. function changeLock(Obj1,Obj2)
  74. {
  75. var url="NewsAction.asp?newsid="+Obj1+"&value="+Obj2+"&r="+Math.random();//构造url
  76. request.open("GET",url,true);//建立连接
  77. request.onreadystatechange = getResult;
  78. request.send(null);//传送数据,因为数据通过url传递了,所以这里传递的是null
  79. }
  80. function getResult()//当服务器响应的时候就使用这个方法
  81. {
  82. if(request.readyState ==4)//根据HTTP 就绪状态判断响应是否完成
  83. {
  84. if(request.status == 200)//判断请求是否成功
  85. {
  86. result=request.responseText;//获得响应的结果,也就是新的<select>
  87. alert("修改成功")
  88. }
  89. }
  90. }
  91. function AddNewsSubmit()
  92. {
  93. location='AddEditNews.asp?Act=add'
  94. }
  95. </script>
  96. </HEAD>
  97. <script language="JavaScript" src="../../FS_Inc/PublicJS.js" type="text/JavaScript"></script>
  98. <script language="JavaScript" src="UserJS.js" type="text/JavaScript"></script>
  99. <link href="../images/skin/Css_<%=Session("Admin_Style_Num")%>/<%=Session("Admin_Style_Num")%>.css" rel="stylesheet" type="text/css">
  100. <BODY LEFTMARGIN=0 TOPMARGIN=0 MARGINWIDTH=0 MARGINHEIGHT=0 scroll=yes  oncontextmenu="return false;"> 
  101. <table width="98%" border="0" align="center" cellpadding="3" cellspacing="1" class="table"> 
  102.   <tr class="hback"> 
  103. <tr class="xingmu"> 
  104. <td width="30%" align="center"><div align="left">公告管理</div></td> 
  105. <td width="20%" align="center">&nbsp;</td>
  106. <td width="15%" align="center">&nbsp;</td>
  107. <td width="15%" align="center">&nbsp;</td> 
  108. <td width="20%" align="center"><input type="Button" name="AddNewsSubmit" value="发布信息" onClick="AddNewsSubmit()"></td> 
  109.   </tr>
  110. </tr> 
  111.     <form action="?Act=addNews" method="post" name="addNewsForm" id="addNewsForm">  
  112.         <tr class="xingmu"> 
  113.           <td width="30%" align="center">标题</td> 
  114.           <td width="20%" align="center">发布时间</td>
  115.           <td width="15%" align="center">允许查看组</td>
  116.           <td width="15%" align="center">积分限制</td> 
  117.   <td width="20%" align="center">锁定</td> 
  118.         </tr>
  119. <%
  120. do while not NewsRs.eof and i<listnum
  121. n=n+1
  122. Response.Write("<tr class='hback'>")
  123. Response.Write("<td align='left'><a href='AddEditNews.asp?act=edit&newsID="&NewsRS("newsid")&"'>"&NewsRs("title")&"</a></td>"&Chr(10)&Chr(13))
  124. Response.Write("<td align='center'>"&NewsRs("addtime")&"</td>"&Chr(10)&Chr(13))
  125. Response.Write("<td align='center'>"&NewsRs("GroupID")&"</td>"&Chr(10)&Chr(13))
  126. Response.Write("<td align='center'>"&NewsRs("NewsPoint")&"</td>"&Chr(10)&Chr(13))
  127. Response.Write("<td align='center'>")
  128. if NewsRs("isLock")=1 then
  129. Response.Write("<input type='Radio' name='"&NewsRs("NewsID")&"' value=1 onclick='changeLock(this.name,this.value)'checked>是&nbsp;&nbsp;&nbsp;&nbsp;"&Chr(10)&Chr(13))
  130. Response.Write("<input type='Radio' name='"&NewsRs("NewsID")&"' value=0 onclick='changeLock(this.name,this.value)'>否"&Chr(10)&Chr(13))
  131. elseif NewsRs("isLock")=0 then
  132. Response.Write("<input type='Radio' name='"&NewsRs("NewsID")&"' value=1 onclick='changeLock(this.name,this.value)')>是&nbsp;&nbsp;&nbsp;&nbsp;"&Chr(10)&Chr(13))
  133. Response.Write("<input type='Radio' name='"&NewsRs("NewsID")&"' value=0 onclick='changeLock(this.name,this.value)' checked>否"&Chr(10)&Chr(13))
  134. end if
  135. Response.Write("</td>")
  136. Response.Write("</tr>")
  137. NewsRs.movenext 
  138. i=i+1 
  139. j=j-1
  140. loop
  141. %> 
  142.     </form>
  143. <tr>
  144. <td align="right" colspan="5">
  145. <%=NewsRs.recordcount%> 条消息&nbsp;&nbsp;<%=listnum%> 条消息/页&nbsp;&nbsp;共 <%=NewsRs.pagecount%> 页 
  146. <% if page=1 then %>
  147. <%else%>
  148. <a href=<%=pagename%>><strong>|<<</strong></a>&nbsp; 
  149. <a href=<%=pagename%>page=<%=page-1%>><strong><<</strong></a>&nbsp; 
  150. <a href=<%=pagename%>page=<%=page-1%>><b>[<%=page-1%>]</b></a>&nbsp; 
  151. <%end if%>
  152. <% if NewsRs.pagecount=1 then %>
  153. <%else%>
  154. <b>[<%=page%>]</b>
  155. <%end if%>
  156. <% if NewsRs.pagecount-page <> 0 then %>
  157. <a href=<%=pagename%>page=<%=page+1%>><b>[<%=page+1%>]</b></a>&nbsp; 
  158. <a href=<%=pagename%>page=<%=page+1%>><strong>>></strong></a>&nbsp; 
  159. <a href=<%=pagename%>page=<%=NewsRs.pagecount%>><strong>>>|</strong></a>&nbsp; 
  160. <%end if%> 
  161. </td>
  162. </tr> 
  163. </table> 
  164. </body>
  165. <%
  166. if Request("Act")="addGroup" then
  167. AddGroupRs.close
  168. set AddGroupRs=nothing
  169. Conn.close
  170. Set Conn=nothing
  171. User_Conn.close
  172. Set User_Conn=nothing
  173. end if
  174. %>
  175. </html>