<!--#Include File="conn.asp"-->
<!--#Include File="top.asp"-->
<SCRIPT LANGUAGE="JavaScript" src="images/js.js"></SCRIPT>
<%
On Error Resume Next
Dim rs,sql,id
If Request.QueryString("id")<> "" Then

id=Request.QueryString("id")

'打开/更新广告数据
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select ADID,ADType,ADSrc,ADHeight,ADWidth,ADLink,ADAlt,ADStopViews,ADStopHits,ADStopDate,ADNote,ADViews,ADHits from [ad] where id=" & clng(id)
rs.Open sql,conn,1,3
'是否更新
If Request.Form("ChangeAD") <> "" Then
	rs("ADID")=DangerEncode(Request.Form("ADID"))
	rs("ADType")=DangerEncode(Request.Form("ADType"))
	rs("ADSrc")=DangerEncode(Request.Form("ADSrc"))
	rs("ADHeight")=TRIM(Request.Form("ADHeight"))
	rs("ADWidth")=TRIM(Request.Form("ADWidth"))
	rs("ADLink")=DangerEncode(Request.Form("ADLink"))
	rs("ADAlt")=DangerEncode(Request.Form("ADAlt"))
	rs("ADStopViews")=TRIM(Request.Form("ADStopViews"))
	rs("ADStopHits")=TRIM(Request.Form("ADStopHits"))
	rs("ADStopDate")=TRIM(Request.Form("ADStopDate"))
	rs("ADNote")=DangerEncode(Request.Form("ADNote"))
	If Request.Form("ADRESET")="YES" Then
		rs("ADViews")=0
		rs("ADHits")=0
	End If
	rs.Update
	Response.Write("<script language=JavaScript>alert('恭喜，修改成功！请重新生成JS文件！');document.location.href='list.asp';</script>")
Response.end
End If
If Err <> 0 Then
			Response.Write "<br><br><font color=red size=2>错误:"&Err.Description
			Response.End
End If
%>
<br>
<table  border="0" align="center" cellpadding="3" cellspacing="1" Class=TableBorder>
  <form name=form action=edit.asp?id=<%=id%>  method=post onSubmit="return chkinput()">
  <tr>
    <th colspan="2">修 改 广 告</th>  
  </tr>
  <tr>
    <td  height="25" align="right" class="forumRow"><div align="right">广告ID：</div></td>                                                          
    <td width="600" class="forumRow"><INPUT name=ADID type="text" class="input1" value="<%=rs("ADID")%>" size=10 maxlength=20> 不能重名</td>                                                         
  </tr>
  <tr>
    <td height="25" align="right" class="forumRow">广告类型：</td>
    <td  Class=forumrow><select name="ADType" size="1" class="input1" onChange="ChangeType(this.options[this.selectedIndex].value)">
  <option <%If rs("ADType")=1 Then Response.Write"selected"%> value="1">普通显示</option>
  <option <%If rs("ADType")=2 Then Response.Write"selected"%> value="2">满屏浮动显示</option>
  <option <%If rs("ADType")=3 Then Response.Write"selected"%> value="3">上下浮动显示 - 右</option>
  <option <%If rs("ADType")=4 Then Response.Write"selected"%> value="4">上下浮动显示 - 左</option>
  <option <%If rs("ADType")=5 Then Response.Write"selected"%> value="5">全屏幕渐隐消失</option>
  <option <%If rs("ADType")=6 Then Response.Write"selected"%> value="6">普通网页对话框 </option>
  <option <%If rs("ADType")=7 Then Response.Write"selected"%> value="7">可移动透明对话框 </option>
  <option <%If rs("ADType")=8 Then Response.Write"selected"%> value="8">打开新窗口</option>
  <option <%If rs("ADType")=9 Then Response.Write"selected"%> value="9">弹出新窗口</option>
  <option <%If rs("ADType")=10 Then Response.Write"selected"%> value="10">对联式广告</option>
</select></td>                                                         
  </tr>
  <tr>
    <td height="25" align="right" class="forumRow" id="adsrc_text">广告地址：</td>
	<td Class=forumrow>
	<%If rs("ADType")= 6 Then
    	Response.Write ("<textarea rows=3 name=ADSrc cols=27 class=input2>"&server.HTMLencode(rs("ADSrc"))&"</textarea>")
	else%>
	<INPUT name="ADSrc" type="text" class="input1" value="<%=rs("ADSrc")%>" size=30>                                                      
	<%end if%>   
    *<a href="#" onclick=openhelp("ext") title="点击查看帮助">图片或FLASH地址？</a></td>   
  </tr>
  <tr>
    <td height="25" align="right" class="forumRow">广告规格：</td>
    <td Class=forumrow><INPUT name=ADWidth type="text" class="input1" onKeyPress="return Num();" value="<%=rs("ADWidth")%>" size=8 maxlength=4>  
      × <INPUT name=ADHeight type="text" class="input1" onKeyPress="return Num();" value="<%=rs("ADHeight")%>" size=8 maxlength=4></td>                     
  </tr>
  <tr style="visibility:hide;">
    <td height="25" align="right" class="forumRow">链接地址：</td>
    <td Class=forumrow><INPUT name=ADLink type="text" class="input1" value="<%=rs("ADLink")%>" size=30 maxlength=150></td>                      
  </tr>
  <tr>
    <td height="25" align="right" class="forumRow">提示文字：</td>
    <td Class=forumrow><INPUT name=ADAlt type="text" class="input1" value="<%=rs("ADAlt")%>" size=30 maxlength=50></td>                      
  </tr>
  <tr>
    <td height="25" align="right" class="forumRow">投放限制：</td>
    <td Class=forumrow><INPUT name=ADStopViews type="text" class="input1" onKeyPress="return Num();" value="<%=rs("ADStopViews")%>" size=8 maxlength=10>
      ·<INPUT name=ADStopHits type="text" class="input1" onKeyPress="return Num();" value="<%=rs("ADStopHits")%>" size=8 maxlength=10>
      ·<INPUT name=ADStopDate type="text" class="input1" value="<%=rs("ADStopDate")%>" size=8 maxlength=19> <a href="#" onclick=openhelp("stop") title="点击查看帮助">显示·点击·日期？</a></td>      
  </tr>
  <tr>
    <td height="25" align="right" class="forumRow">重新统计：</td>
    <td Class=forumrow><input type="checkbox" name="ADRESET" value="YES"> 重置显示和点击次数</td>                     
  </tr>
  <tr>
    <td height="25" align="right" class="forumRow">简单注释：</td>
    <td Class=forumrow><INPUT name=ADNote type="text" class="input1" value="<%=rs("ADNote")%>" size=30 maxlength=100> 备注不显示在广告中</td>                     
  </tr>
  <tr>
    <td height="25" colspan="2" align="center"  Class=forumrowhighlight>
      <INPUT name="ChangeAD" type="submit" class="input1" value="确 定"> </td>
  </tr></form>
</table>

<%
    Response.Write "<Script language=javascript>ChangeType('"&rs("ADType")&"')</Script>"
	rs.Close
	set rs=nothing
	conn.Close
	set conn=nothing
	
Else
	Response.Write ("<script>alert(' 操作错误! \n\n 没有指明要编辑的ID!');history.back();</script>")
End If

Rem 过滤可能出错误的符号
Function DangerEncode(fString)
If not isnull(fString) Then
    fString = Replace(fString, CHR(13), "")
    fString = Replace(fString, CHR(10), "")
	fString = replace(fString, "'", """")
    fString = Trim(fString)
    DangerEncode = fString
End If
End Function
%>
<!--#Include File="bottom.asp"-->
