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

📄 news.asp

📁 1.理解Winsock编程模型; 2.掌握Winsock编程的基本方法
💻 ASP
📖 第 1 页 / 共 2 页
字号:
                <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 + "&nbsp;&nbsp;<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>&nbsp;&nbsp;添加注释:</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>&nbsp;<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">发布<br>日期</font></td>
      <td colspan="3" background="images/015.gif"><input name="PubDate" type="text" value="<%=date()%>" size="20" maxlength="20">
          <font color="black">如果是未来的日期,就是到该日期才会生效</font></td>
    </tr>
    <tr>
      <td align="right" background="images/013.gif"><font color="black">是否在线</font></td>
      <td colspan="3" background="images/013.gif">
        <input type="radio" name="Online" value="1" checked>
        <font color="black">是
        <input type="radio" name="Online" value="0">
      </tr>
    <tr height="39">
      <td align="right" background="images/010.gif">&nbsp;
          <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=news.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
		lm=trim(request("newsclass"))
		lm0=trim(request("newsclass1"))
		if lm<>"请选择" then
  aaa=split(lm,"|")
 
  lm1=aaa(0)
   if ubound(aaa)="2" then
  lm2=aaa(1)
  end if
        else
	aaa=split(lm0,"|")
  lm1=aaa(0)
  if ubound(aaa)="2" then
  lm2=aaa(1)
  end if
        end if	
		titlecolor=request.form("titlecolor")
		rs("lm")=lm1
		
  rs("lm2")=lm2
		rs("title")=request.form("title")
		rs("titlecolor")=request.form("titlecolor")
		rs("content")=request.form("content")
		rs("PubDate")=now()
		if lm<>"请选择" then				
		rs("NewsClass")=lm
		else
		rs("NewsClass")=lm0
		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=news.asp?action=加新闻"">"
	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='news.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 value="<%=rs("titlecolor")%>" style="background-color:<%=rs("titlecolor")%>">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</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='news.asp';" value="取消修改"></TD></TR>
	  <TR><TD align="right" background="images/009.gif">><font color="black">新闻类型</font></TD>
	 <TD background="images/017.gif"><input type="text" name="newsclass1" value="<%=rs("newsclass")%>"><font color="#000000">&nbsp;</font>&nbsp;修改为:<select name="newsclass">  
	 <option value="请选择">请选择</option>   
	    <%					  
					  sql7 = "select * from lm where lm<>'' order by id asc"
					  Set rs7 = Server.CreateObject("ADODB.RecordSet")
					  rs7.Open sql7,conn,1,1
					  while not rs7.eof
					  if rs7("moban")="1" then
					  %>
					   <option value='<%=rs7("id")%>|'><%=rs7("lm")%></option>
					   <% else 
					       response.write "<optgroup label='"&rs7("lm")&"'>"
						    end if
							sql2 = "select * from lm where lmid='"&rs7("id")&"' order by id asc"
							Set rs2 = Server.CreateObject("ADODB.RecordSet")
							rs2.Open sql2,conn,1,1
							while not rs2.eof
							%>
							   <option value='<%=rs7("id")%>|<%=rs2("id")%>' <% if int(lmid)=rs2("id") then response.write " selected" %>>├(编号:<%=rs2("id")%>)<%=rs2("lm2")%></option>
							<%
							rs2.movenext
							wend
					  rs7.movenext
					  wend 
					  rs7.close
					  set rs7=nothing
					
					%>
        </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 + "&nbsp;&nbsp;<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>&nbsp;&nbsp;添加注释:</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>&nbsp;<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">类似:2007-2-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">&nbsp;<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

%>
</body>
</html>

⌨️ 快捷键说明

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