<%@language=VBScript.Encode codepage=936 %>
<!--#include file="conn.asp"-->
<!--#include file="application.asp"-->
<!--#include file="admin.asp"-->
<!--#include file="Inc/Function.asp"-->
<%
If trim(request("action"))="Edit" then
   ID=trim(request("ID"))
   If isnumeric(ID)=false then
      response.Write("<script lanaguge='javascript'>alert('参数有错误！！');history.back();</script>")
      response.End()
   end if
   AdName=trim(request("AdName"))
   AdFile=trim(request("FileName"))
   AdLink=trim(request("AdLink"))
   set rs=server.CreateObject("adodb.recordset")
   rs.open"select * from [ad] where ID="&ID,conn,1,3
   if not rs.eof then
      rs("AdName")=AdName
	  rs("AdFile")=AdFile
	  rs("AdLink")=AdLink
	  rs("AdTime")=now()
      rs.update
      rs.close:set rs=nothing
      response.Write("<script lanaguge='javascript'>alert('广告修改成功！');location.href='Ad.asp';</script>")
      response.End()
   end if
end if
ID=trim(request("ID"))
Set rs=server.CreateObject("Adodb.recordset")
rs.open"select * from [Ad] where ID="&ID,conn,1,1
if not rs.eof then
   AdName=Trim(rs("AdName"))
   FileName=Trim(rs("AdFile"))
   AdLink=Trim(rs("AdLink"))
end if
%>
<script language = "JavaScript">
function CheckForm(){
  if (document.myform.FileName.value==""){
    alert("广告图片不能为空！");
	document.myform.FileName.focus();
	return false;
  }
  return true;  
}
</script>
<!-- #include file="Inc/Head.asp" -->
<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
  <tr> 
    <td width="862" align="center" valign="top"> <b><br>
      </b>
        <form method="POST" name="myform" action="?action=Edit" onSubmit="return CheckForm();">
		<input type="hidden" name="ID" value="<%=ID%>">
        <table width="650" border="0" align="center" cellpadding="0" cellspacing="0" class="border">
          <tr align="center"> 
            <td class="tdbg"> <table width="100%" border="0" cellpadding="2" cellspacing="1" class="table_southidc">
                <tr> 
                  <td class="back_southidc" height="22" colspan="3" align="right" bgcolor="#A4B6D7"><div align="center"><b>修 改 广 告</b> </div></td>
                </tr>
                <tr> 
                  <td width="89" height="21" align="right" bgcolor="#A4B6D7">广告名称：</td>
                  <td colspan="2" bgcolor="#E3E3E3"> <strong> 
                    <input name="AdName" type="text" id="AdName" value="<%=AdName%>" size="30" maxlength="50">
                  </strong></td>
                </tr>
				<tr> 
                  <td width="89" height="21" align="right" bgcolor="#A4B6D7">广告图片：</td>
                  <td width="232" bgcolor="#E3E3E3"> <strong> 
                    <input name="FileName" type="text" id="FileName" value="<%=FileName%>" size="30" maxlength="50">                    </td>
                  <td width="313" bgcolor="#E3E3E3"><iframe frameborder="0" height="23" name="Upload" scrolling="no" src="Upload_Photo.asp"></iframe></td>
				</tr>
				<tr> 
                  <td width="89" height="21" align="right" bgcolor="#A4B6D7">广告链接：</td>
                  <td colspan="2" bgcolor="#E3E3E3"> <strong> 
                    <input name="AdLink" type="text" id="AdLink" value="<%=AdLink%>" size="30" maxlength="50">
                  </strong></td>
                </tr>
                <tr bgcolor="#E3E3E3"> 
                  <td height="22" colspan="3" align="right"> <div align="center"> 
                      <input name="Add" type="submit"  id="Add2" value=" 修 改 ">
                    </div></td>
                </tr>
              </table></td>
          </tr>
        </table>
		 
        <div align="center">
          <p>&nbsp;  </p>
        </div>
      </form></td>
  </tr>
</table>
<!-- #include file="Inc/Foot.asp" -->