一打开页面就弹出警告框,本应该表单为空时才弹出的,求教原因及解决方法!!!

向数据库添加数据时,验证表单内容是否为空,若为空就弹出警告框。但是每当刚打开页面就弹出警告框,怎么回事啊?代码如下:
<% 
if trim(request.form("testStQuestion")) <> "" then
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select  * from TestOnlySelect"
rs.open sql,conn,1,3

rs.addnew

rs("testStQuestion")=request.form("testStQuestion")
rs("testOptionA")=request.form("testOptionA")

rs.update
rs.close
elseif trim(request.form("testStQuestion")) = "" then 
%>

alert("请完整添加题目和答案!")

<%
end if
 %>
 
   



 

你可能感兴趣的:(一打开页面就弹出警告框,本应该表单为空时才弹出的,求教原因及解决方法!!!)