news1.asp
来自「1.理解Winsock编程模型; 2.掌握Winsock编程的基本方法」· ASP 代码 · 共 813 行 · 第 1/3 页
ASP
813 行
<input type="hidden" name=add value="ok"></td>
<td colspan="3" background="images/010.gif">
<input type="submit" name="submit" value="提交">
<input type="reset" name="Submit2" value="重新填写">
</td>
</tr>
</form>
</table>
<%
end if
end sub
sub modify()
if id="" then
response.write "非法新闻编号"
response.write "<meta http-equiv=refresh content=""1;URL=news1.asp"">"
else
'修改新闻资料
if request("modify")="ok" then
if request("title")="" then
%>
<script language="javascript">
if (confirm("新闻标题不能为空!"))
location.href="news.asp?action=加新闻";
</script>
<%
elseif request("newsclass1")="请选择" then
%>
<script language="javascript">
if (confirm("请您选择所添加的新闻类型!"))
location.href="news.asp?action=加新闻";
</script>
<%
elseif request("content")="" then
%>
<script language="javascript">
if (confirm("请添加新闻内容!"))
location.href="news.asp?action=加新闻";
</script>
<%
if request("hug")<>"" then
For m=1 to request("Hug")
if request("Hug"&m&"")="" then
%>
<script language="javascript">
if (confirm("请您上传所要添加的图片!"))
location.href="news.asp?action=加新闻";
</script>
<%
end if
next
end if
else
set rs=server.createobject("adodb.recordset")
sql = "select * from News where NewsId="&id
rs.open sql,conn,3,2
if err.number<>0 then
response.write "数据库操作失败:" & err.description '错误描述
err.clear
else
if not (rs.eof and rs.bof) then
rs("title")=request.form("title")
rs("titlecolor")=request.form("titlecolor")
rs("content")=request.form("content")
rs("PubDate")=now()
aa=request.form("NewsClass1")
aa=split(aa,",")
bb1=aa(0)
bb2=aa(1)
if bb2<>"" then
rs("class")=bb2
end if
rs("Online")=request.form("Online")
rs.update
end if
end if
rs.close
if request("Hug")<>"" then
set rs2=Server.CreateObject("adodb.recordset")
sql2 = "select * from News where newsid="&id
rs2.open sql2,conn,3,2
n=rs2("newsid")
rs2("tupian")=true
rs2("jizhang")=request("Hug")
rs2.update
Set rs1=Server.CreateObject("ADODB.Recordset")
sql1 = "select * from sptp where spid="&id
rs1.open sql1,conn,3,2
if rs1.eof then
For m=1 to request("Hug")
rs1.addnew
rs1("FilePath")=request("Hug"&m&"")
rs1("content")=request(""&m&"")
rs1("spid")=n
rs1.update
next
else
do while not rs1.eof
rs1.delete
rs1.movenext
loop
For m=1 to request("Hug")
rs1.addnew
rs1("FilePath")=request("Hug"&m&"")
rs1("content")=request(""&m&"")
rs1("spid")=n
rs1.update
next
rs1.close
rs2.close
end if
end if
response.write "<font color='#000000'>新闻资料已经修改</font>"
response.write "<meta http-equiv=refresh content=""1;URL=news1.asp?action=修改&id="&id&""">"
response.end
end if
end if
'显示详细资料
set rs = server.createobject("adodb.recordset")
sql = "select * from News where NewsId="&id
rs.open sql,conn,3,2
if err.number<>0 then '错误处理
response.write "数据库操作失败:" & err.description '错误描述
err.clear
else
if not (rs.eof and rs.bof) then
%>
<TABLE width="100%" border=1 cellpadding=3 style="border-collapse: collapse" bordercolor="#3D5489" align=center>
<form name=form1 method="post" action='news1.asp?action=修改&id=<%=id%>'>
<TR><TD align="right" background="images/wo.gif"><font color="black">新闻标题</font></TD>
<TD background="images/wo.gif"><input name="title" type="text" value="<%=rs("title")%>" size="50" maxlength="50"><select size="1" name="titlecolor">
<option>默认颜色</option>
<OPTION <%if titlecolor="#000000" then response.write "selected"%> value="#000000" style="background-color:#000000"></OPTION>
<OPTION <%if titlecolor="#FFFFFF" then response.write "selected"%> value="#FFFFFF" style="background-color:#FFFFFF"></OPTION>
<OPTION <%if titlecolor="#008000" then response.write "selected"%> value="#008000" style="background-color:#008000"></OPTION>
<OPTION <%if titlecolor="#800000" then response.write "selected"%> value="#800000" style="background-color:#800000"></OPTION>
<OPTION <%if titlecolor="#808000" then response.write "selected"%> value="#808000" style="background-color:#808000"></OPTION>
<OPTION <%if titlecolor="#000080" then response.write "selected"%> value="#000080" style="background-color:#000080"></OPTION>
<OPTION <%if titlecolor="#800080" then response.write "selected"%> value="#800080" style="background-color:#800080"></OPTION>
<OPTION <%if titlecolor="#808080" then response.write "selected"%> value="#808080" style="background-color:#808080"></OPTION>
<OPTION <%if titlecolor="#FFFF00" then response.write "selected"%> value="#FFFF00" style="background-color:#FFFF00"></OPTION>
<OPTION <%if titlecolor="#00FF00" then response.write "selected"%> value="#00FF00" style="background-color:#00FF00"></OPTION>
<OPTION <%if titlecolor="#00FFFF" then response.write "selected"%> value="#00FFFF" style="background-color:#00FFFF"></OPTION>
<OPTION <%if titlecolor="#FF00FF" then response.write "selected"%> value="#FF00FF" style="background-color:#FF00FF"></OPTION>
<OPTION <%if titlecolor="#FF0000" then response.write "selected"%> value="#FF0000" style="background-color:#FF0000"></OPTION>
<OPTION <%if titlecolor="#0000FF" then response.write "selected"%> value="#0000FF" style="background-color:#0000FF"></OPTION>
<OPTION <%if titlecolor="#008080" then response.write "selected"%> value="#008080" style="background-color:#008080"></OPTION>
</select><input type="button" name="action" onclick="javascript:location.href='news1.asp';" value="取消修改"></TD></TR>
<% ni=rs("newsclass")
hao=rs("class")
%>
<TR><TD align="right" background="images/009.gif">><font color="black">新闻类型</font></TD>
<TD background="images/017.gif">></font><select name="newsclass1">
<option value="请选择">请选择</option>
<optgroup label='学院动态'>
<% if hao="院内" then %>
<option value="学院动态,院内" selected>├学院动态(院内)</option>
<% else %>
<option value="学院动态,院内">├学院动态(院内)</option>
<% end if
if hao="院外" then
%>
<option value="学院动态,院外" selected>├学院动态(院外)</option>
<% else %>
<option value="学院动态,院外">├学院动态(院外)</option>
<% end if
if ni="院内公告" then
%>
<optgroup label='院内公告'>
<option value="院内公告," selected>├院内公告</option>
<% else %>
<optgroup label='院内公告'>
<option value="院内公告,">├院内公告</option>
<% end if %>
</select>
</select>
</TD></TR>
<%
content=rs("content")
%>
<tr>
<td align="right" bgcolor="#cbe1fc"><textarea name="content" style="display:none" cols="1" rows="1"><%if content<>"" then response.write content%></textarea></td>
<td colspan="3"><IFRAME ID="eWebEditor1" SRC="edit/ewebeditor.asp?id=content&style=news" FRAMEBORDER="0" SCROLLING="no" WIDTH="100%" HEIGHT="399" marginwidth="1" marginheight="1" name="wfasdg"></IFRAME>
</td>
</tr>
<td colspan="4" align="right"><div align="left">
<table width="100%" border="1" cellpadding="0" cellspacing="0" background="images/015.gif">
<div>
<tr>
<td width="100" align="right"><div align="center"></div>
<div align="right"><font color="black">商品图片:</font></div></td>
<td width="69" align="right"><input type="radio" name="FileOther" value=1 onClick=JM_you(s1)></td>
<script language="JavaScript">
function JM_wu(ob){
ob.style.display="none";
}
function JM_you(ob){
ob.style.display="";
}
function uppic(model,frmname) {
window.open("upload.asp?uppath=digi&ProdId="+model+"&frmname="+frmname,"upload", "left=12, top=12, width=400, height=300, resizable=1,menubar=1,scrollbars=1")
}
function createForm(textN,number) {
data = "";
inter = "'";
if (number < 11 && number > -1) {
for (i=1; i <= number; i++) {
if (i < 10) spaces=" ";
else spaces=" ";
data =data + " <input name="+textN+i+" type=text value='' size='30' maxlength='100'><INPUT TYPE='button' value='上传"+i+"' onclick=javascript:uppic('_hug"+i+"','Hug"+i+"')><font color=black> 添加注释:</font><input name="+i+" type=text value='' size='30' maxlength='200'><br>";
}
if (document.layers) {
document.layers.cust.document.write(data);
document.layers.cust.document.close();
}
else {
if (document.all) {
cust.innerHTML = data;
}
}
}
else {
window.alert("请不要超过10张图片.");
}
}
// End -->
</script>
<td width="798"><font color="black"> 有</font> <span id=s1 style="display:none">
<input name="Hug" type=text value='' size='1' maxlength='1'>
<input name="button" type=button onClick="createForm('Hug',document.form1.Hug.value);" value="张商品图片">
<br>
</span> <span id=cust style="position:relative;"> </span>
</tr>
</div>
</table>
</div></td>
</tr>
<TR><TD align="right" background="images/015.gif"><font color="black">发布日期</font></TD>
<TD background="images/015.gif"><input name="PubDate" type="text" value="<%=rs("PubDate")%>" size="20" maxlength="20">类似:2004-12-14</TD></TR>
<TR><TD align="right" background="images/013.gif"><font color="black">是否在线</font></TD>
<TD background="images/013.gif"><font color="black">是<input type="radio" name="Online" value="1" <%if rs("Online")=true then%>checked<%end if%>>
</font>否<input type="radio" name="Online" value="0" <%if rs("Online")=false then%>checked<%end if%>>
</TD></TR>
<TD align="right" background="images/010.gif"> <INPUT TYPE="hidden" name="modify" value="ok"></TD><TD background="images/010.gif">
<input type="submit" name="submit" value="提交修改"> <input type="reset" name="Submit2" value="重新修改">
</TD></TR>
</form></TABLE>
<%
else
response.write "<BR><BLOCKQUOTE>无此序号商品!<br><br><font color=yellow><B>请检查!</B></font><BR></BLOCKQUOTE>"
end if
end if
rs.close
set rs=nothing
end if
end sub
%>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?