消息: 'document.form1.xclassid' 为空或不是对象
manage
网页错误详细信息
用户代理: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 5.1; Trident/4.0)
时间戳: Sat, 11 Jun 2011 17:11:24 UTC
消息: 'document.form1.xclassid' 为空或不是对象
行: 93
字符: 3
代码: 0
URI: http://127.0.0.1/manage/addnews.asp
........................................................................................................
<!--#include file="conn.asp"-->
<!--#include file="adminset.asp"-->
<!--#include file="../fuction.asp"-->
<%if request.Cookies("admin_guanli")="" then
response.Write "<script LANGUAGE='javascript'>alert('网络超时或者您还没有登录请登录');window.location.href='login.asp';</script>"
response.End
end if
if qx8<>1 then
response.Write "<div align=center><font size=80 color=red><b>您没有此项目管理权限!</b></font></div>"
response.End
end if
if request.QueryString("action")="save" then
if session("flag_guanli")>1 then
response.Write "<div align=center><font size=80 color=red><b>您没有此项目管理权限!</b></font></div>"
response.End
end if
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from shop_news",conn,1,3
rs.addnew
rs("classid")=request("anclassid")
rs("classid2")=request("nclassid")
rs("classid3")=request("xclassid")
rs("newsname")=trim(request("newsname"))
rs("addname")=trim(request("addname"))
if trim(request("tp"))="" then
rs("tp")=1
else
rs("tp")=trim(request("tp"))
end if
if trim(request("newstop"))="" then
rs("newstop")=1
else
rs("newstop")=trim(request("newstop"))
end if
if trim(request("newstj"))="" then
rs("newstj")=1
else
rs("newstj")=trim(request("newstj"))
end if
if trim(request("iuser"))="" then
rs("iuser")=1
else
rs("iuser")=trim(request("iuser"))
end if
Content=Request.Form("content")
rs("newscontent")=content
rs("adddate")=request("adddate")
rs("defaultpic")=request("defaultpic")
rs("viewcount")=0
rs.update
rs.close
set rs=nothing
session("content")=""
response.write "<script language=javascript>alert('添加成功!');window.location.href='editnews.asp';</script>"
response.End
end if
%>
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<script language="javascript">
<!--
function checkdata()
{
if (form1.newsname.value=="")
{
alert("对不起,请输入新闻主题!")
form1.newsname.focus()
return false
}
}
function MM_goToURL() { //v3.0
var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}
function MM_openBrWindow(theURL,winName,features) { //v2.0
window.open(theURL,winName,features);
}
//-->
</script>
<%dim count
set rs=server.createobject("adodb.recordset")
rs.open "select * from shop_news_class2 order by px ",conn,1,1
set rs2=server.createobject("adodb.recordset")
rs2.open "select * from shop_news_class3 order by px ",conn,1,1
%>
<script language = "JavaScript">
var onecount;
var threecount;
onecount=0;
threecount=0
subcat3=new Array();
<%
count = 0
do while not rs2.eof
%>
subcat3[<%=count%>] = new Array("<%= trim(rs2("classname"))%>","<%= rs2("classid2")%>","<%= rs2("id")%>");
<%
count = count + 1
rs2.movenext
loop
rs2.close
%>
threecount=<%=count%>;
subcat = new Array();
<%
count = 0
do while not rs.eof
%>
subcat[<%=count%>] = new Array("<%= trim(rs("classname"))%>","<%= rs("classid1")%>","<%= rs("id")%>");
<%
count = count + 1
rs.movenext
loop
rs.close
%>
onecount=<%=count%>;
function changelocation(locationid)
{
document.form1.nclassid.length = 0;
var locationid=locationid;
var i;
for (i=0;i < onecount; i++)
{
if (subcat[i][1] == locationid)
{
document.form1.nclassid.options[document.form1.nclassid.length] = new Option(subcat[i][0], subcat[i][2]);
}
}
if(document.form1.nclassid.length!=0){
changelocation3(document.form1.nclassid.options[document.form1.nclassid.selectedIndex].value)
}else{
document.form1.xclassid.length=0
}
}
function changelocation3(locationid)
{
document.form1.xclassid.length = 0;
var locationid=locationid;
var i;
for (i=0;i < threecount; i++)
{
if (subcat3[i][1] == locationid)
{
document.form1.xclassid.options[document.form1.xclassid.length] = new Option(subcat3[i][0], subcat3[i][2]);
}
}
}
//-->
</script>
<link href="../css.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style></head>
<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0" background="images/right_top2.gif">
<tr>
<td width="1%"> </td>
<td width="99%"><table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td width="30%" style="font-size:14px;color:#ffffff"> <strong><font color="#000000">添加网站新闻</font></strong></td>
<td width="70%" align="right"> </td>
</tr>
</table></td>
</tr>
</table>
<br>
<form name="form1" method="post" action="addnews.asp?action=save" onSubmit="return checkdata()" >
<br>
<table width="90%" border="0" align="center" cellpadding="3" cellspacing="1" bgcolor="cccccc">
<tr bgcolor="#F0F3F8">
<td width="107" bgcolor="efefef" style="PADDING-LEFT: 6px"><div align="center">新闻主题:</div></td>
<td width="772" bgcolor="ffffff" style="PADDING-LEFT: 6px">
<input name="newsname" class="wenbenkuang" type="text" id="newsname" size="60"> </td>
</tr>
<tr bgcolor="#F0F3F8">
<td bgcolor="efefef" style="PADDING-LEFT: 6px"><div align="center">选择分类:</div></td>
<td width="772" bgcolor="ffffff" style="PADDING-LEFT: 6px">
大类:
<%set rs=server.CreateObject("adodb.recordset")
rs.open "select * from shop_news_class order by px",conn,1,1
if rs.eof and rs.bof then
response.write "请先添加栏目。"
response.end
else
%>
<select name="anclassid" size="1" id="anclassid" onChange="changelocation(document.form1.anclassid.options[document.form1.anclassid.selectedIndex].value)">
<%
dim selclass
selclass=rs("id")
do while not rs.eof
response.write "<option value="&rs("id")
if anclassid=rs("id") then response.write " selected "
response.write ">"&trim(rs("classname"))&"</option>"
rs.movenext
loop
end if
rs.close
%>
</select>
小类:
<select name="nclassid" size="1" id="nclassid" >
<%
set rs=server.CreateObject("adodb.recordset")
rs.open "select * from shop_news_class2 where classid1="&selclass,conn,1,1
if not(rs.eof and rs.bof) then
dim selclass3
selclass3=rs("id")
do while not rs.eof
response.write "<option value="&rs("id")
if nclassid=rs("id") then response.write " selected "
response.write ">"&trim(rs("classname"))&"</option>"
rs.movenext
loop
end if
rs.close
set rs = nothing
%>
</select>
</td>
</tr>
<tr bgcolor="#F0F3F8">
<td width="107" bgcolor="efefef" style="PADDING-LEFT: 6px"><div align="center">发 表 人:</div></td>
<td width="772" bgcolor="ffffff" style="PADDING-LEFT: 6px">
<input name="addname" type="text" class="wenbenkuang" id="addname" value="<%=session("admin_guanli")%>" size="30"></td>
</tr>
<tr bgcolor="#F0F3F8">
<td width="107" bgcolor="efefef" style="PADDING-LEFT: 6px"><div align="center">时间:</div></td>
<td width="772" bgcolor="ffffff" style="PADDING-LEFT: 6px">
<input name="adddate" type="text" class="wenbenkuang" id="adddate" value="<%=date()%>" size="30"></td>
</tr>
<tr bgcolor="#F0F3F8">
<td width="107" bgcolor="efefef" style="PADDING-LEFT: 6px"><div align="center">默认图片:</div></td>
<td width="772" align=left bgcolor="ffffff" style="PADDING-LEFT: 6px">
<input name="defaultpic" type="text" class="wenbenkuang" id="defaultpic" size="50">
<input type="button" name="Submit2" class="go-wenbenkuang" value="上传图片" onClick="window.open('../upload.asp?formname=form1&editname=defaultpic&uppath=shoppic&filelx=jpg','','status=no,scrollbars=no,top=20,left=110,width=420,height=165')">
</td>
</tr>
<tr bgcolor="#F0F3F8">
<td width="107" bgcolor="efefef" style="PADDING-LEFT: 6px"><div align="center">新闻内容:</div></td>
<td width="772" align=left bgcolor="ffffff" style="PADDING-LEFT: 6px">
<IFRAME ID="eWebEditor1" SRC="eweb/ewebeditor.asp?id=Content&style=snsn" FRAMEBORDER="0" SCROLLING="no" WIDTH="550" HEIGHT="350"></IFRAME>
<br> </td>
</tr>
<tr bgcolor="#F0F3F8">
<td height="28" colspan="2" align="center" bgcolor="efefef" style="PADDING-LEFT: 6px"><div align="center">
<input type="submit" class="go-wenbenkuang" name="Submit" value="提交发表" >
<input type="hidden" name="Content" value="">
</div></td>
</tr>
</table>
</form>
<br>
<br>
<!--#include file="copyright.asp"-->
</body>
</html>
[解决办法]
HTML中确实没没有对xclassid的定义
1、你将anclassid或nclassid写错了
2、你缺少一段类似如下的代码
<select name="anclassid" size="1" id="anclassid" onChange="changelocation(document.form1.anclassid.options[document.form1.anclassid.selectedIndex].value)">
<%
dim selclass
selclass=rs("id")
do while not rs.eof
response.write "<option value="&rs("id")
if anclassid=rs("id") then response.write " selected "
response.write ">"&trim(rs("classname"))&"</option>"
rs.movenext
loop
end if
rs.close
%>
</select>