⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 news.asp

📁 本房地产网站功能强大
💻 ASP
📖 第 1 页 / 共 2 页
字号:
    document.form3.sort.focus();     
    return 0;     
  };    
  if (document.form3.topic.value.length==0)     
  {     
    alert("请填写新闻标题。");     
    document.form3.topic.focus();     
    return 0;     
  };  
  
  if (document.form3.comment.value.length==0)     
  {     
    alert("请填写新闻内容。");     
    document.form3.comment.focus();     
    return 0;     
  }; 
 

  return 1;     
}					
 
</script>
                  <form action="?action=saveedit" method="post" name="form3" id="form3">
                    <div align="center"> 
                      <center>
                        <%
newsid=RtnReplaceInt(request("newsid"),0)
set rs=server.createobject("adodb.recordset")
sql="select * from news where newsid="&newsid&""
rs.open sql,conn,1,1
if rs.eof then
response.write "没有信息" 
end if
if not rs.eof then
%>
                        <table border="0" width="73%" cellspacing="1" cellpadding="0" class="black">
                          <tr> 
                            <td width="100%" valign="top"> 
							<div align="center">
							<table border="0" width="100%" cellspacing="1" cellpadding="0" bgcolor="#AABFEC">
                                <tr> 
                                  <td class="black">新闻类型: </td>
                                  <td class="black"> <select name="sort" id="select3">
                                                         <%for idi=1 to sortcount
                         strrssort=rs("sort")
                         sortnum=idi
                          %>
                                      <option value="<%=idi%>" <%if cstr(strrssort)=cstr(idi) then Response.write("selected") end if%>> 
                                      <!--#include file=../inc/sort.asp-->
                                      </option><%next%>
                                    </select> <input name="newsid" type="hidden" id="newsid" value="<%=rs("newsid")%>"></td>
                                </tr>
                                <tr> 
                                  <td height="19" class="black">新闻标题: </td>
                                  <td class="black"> <input name="topic" type="text" id="topic" value="<%=trim(rs("topic"))%>" size="50" maxlength=50> 
                                  </td>
                                </tr>
                                <tr> 
                                  <td width="21%" height="19" valign="top" class="black"> 
                                    新闻出处:</td>
                                  <td width="79%" class="black" valign="top"> 
                                    <input name="fromw" type="text" id="fromw" value="<%=trim(rs("fromw"))%>" size="50" maxlength=50> 
                                  </td>
                                </tr>
                                <tr>
                                  <td width="21%" height="19" valign="top" class="black"> 
                                     </td>
                                  <td width="79%" class="black" valign="top">
                                    <textarea rows="16" name="comment" cols="70"><%=Server.HTMLEncode(Rs("comment"))%></textarea><p> 
                                    <font color="#FF0000">
									[注]免费版只能使用纯文本输入,收费版可以使用图文编辑器</font></td>
                                </tr>
                                <tr> 
                                  <td valign="middle" height="50" class="black" colspan="2">&nbsp; 
                                    <div align="center"> 
                                      <input type="submit" value="修改" name="B1">
                                        </div></td>
                                </tr>
                              </table></div>
							</td>
                          </tr>
                        </table>
                        <%
end if
rs.close
set rs=nothing
%>
                      </center>
                    </div>
                  </form>
                  <%
                  end sub
                  sub add
                  %><script language="JavaScript">
function saveexit()
{
  
  if (chk()==0)
  {
    return false;
  }
  document.form3.submit();
}
function chk()     
{  
  if (document.form3.sort.value.length==0)     
  {     
    alert("请选择新闻类型。");     
    document.form3.sort.focus();     
    return 0;     
  };    
  if (document.form3.topic.value.length==0)     
  {     
    alert("请填写新闻标题。");     
    document.form3.topic.focus();     
    return 0;     
  };  
  
  if (document.form3.comment.value.length==0)     
  {     
    alert("请填写新闻内容。");     
    document.form3.comment.focus();     
    return 0;     
  }; 
 

  return 1;     
}					
 
</script><div align="center">
	<table border="0" width="80%" cellspacing="1" cellpadding="0" class="black">
                        <form action="?action=saveadd" method="post" name="form3" id="form3">
                          <tr> 
                            <td width="100%" valign="top"> 
							<div align="center">
								<table border="0" width="100%" cellspacing="1" cellpadding="0" bgcolor="#AABFEC">
                                <tr> 
                                  <td class="black" width="15%">新闻类型: </td>
                                  <td class="black" width="85%"> <select name="sort" id="sort">
                                      <option value="">选择新闻类型</option>
                       <%for idi=1 to sortcount
                          sortnum=idi
                          %>
                          <option value=<%=idi%>><!--#include file="../inc/sort.asp" --></option>
                          <%next%>
                                     </select></td>
                                </tr>
                                <tr> 
                                  <td height="19" class="black" width="15%">新闻标题: 
                                  </td>
                                  <td class="black" width="85%"> <input name="topic" type="text" id="topic" size="50" maxlength=50> 
                                  </td>
                                </tr>
                                <tr> 
                                  <td width="15%" class="black" valign="top"> 
                                    新闻出处:</td>
                                  <td width="85%" class="black" valign="top"> 
                                    <input name="fromw" type="text" id="fromw" size="50" maxlength=50> 
                                  </td>
                                </tr>

                                <tr>
                                  <td width="15%" class="black" valign="top"> 
                                     </td>
                                  <td width="85%" class="black" valign="top"> <textarea rows="16" name="comment" cols="70"></textarea>
</td>
                                </tr>
                                <tr> 
                                  <td valign="middle" height="20" class="black" colspan="2"> 
                                    <div align="center"> 
                                      <input type="button" value="添加" name="B1" onClick="javascript:return saveexit()">
                                        
                                      <input type="reset" name="Reset" value="清除">
                                    </div></td>
                                </tr>
                              </table></div>
							</td>
                          </tr>
                        </form>
                      </table></div>
<%
                  end sub
                  sub saveedit
                  newsid=request("newsid")
topic=trim(request("topic"))
topic="'" & replace(topic,"'","''") & "'"
'img=trim(request("imgname"))
'if img="undefined" Then
  'img=""
 'End if
'img=Trim(img)
sort=trim(request("sort"))
fromw=trim(request("fromw"))
fromw="'" & replace(fromw,"'","''") & "'"
comment=request("comment")
comment= replace(comment,"'","''")
comment="'" & replace(comment,vbcrlf,"<br>") & "'"
sql="update  news set topic="&topic&",fromw="&fromw&",sort='"&sort&"',comment="&comment&" where newsid="&newsid&"" 
'response.write(sql)
'response.end
conn.execute sql
response.redirect"news.asp"
                  end sub
                  sub saveadd
                  topic=trim(request("topic"))
topic="'" & replace(topic,"'","''") & "'"
'img=trim(request("imgname"))
'if img="undefined" Then
  'img=""
 'End if
' img=Replace(img,vbcrlf,"")
sort=trim(request("sort"))
fromw=trim(request("fromw"))
fromw="'" & replace(fromw,"'","''") & "'"
comment=request("comment")
comment=replace(comment,"'","''")
comment="'" & replace(comment,vbcrlf,"<br>") & "'"
sql="insert into news(topic,fromw,sort,comment) values("&topic&","&fromw&",'"&sort&"',"&comment&")"
opendataconn
conn.execute sql
response.redirect"news.asp"
                  end sub
                  sub del
                    ids=split(request("newsid"),",") 
  for i=0 to ubound(ids)
    tt=trim(ids(i))
	set rs=server.createobject("adodb.recordset")
	conn.execute"delete from news where newsid="&tt&""
        next
  response.redirect"news.asp"
                  end sub
                  closedataconn%><!--#include file="end.asp" -->
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -