<!--#include file="../SQLconn.asp"-->
<html>

<head>

<title>保存文件</title>
<link rel="stylesheet" type="text/css" href="../css/style.css" />
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<style type="text/css">
<!--
.STYLE3 {font-size: 12px}
-->
</style>
</head>
<body  topmargin="5" leftmargin="5">

<% 
		nowxueqi=request.cookies("nowxueqi")
		
		tname=request.cookies("tname")			
		strGrade = TRIM( Request( "grade" ) )
		
		strsubject= TRIM(Request("subject"))
		strzhouci = TRIM( Request( "zhouci" ) )
		ftype = TRIM( Request( "ftype" ) )
		%>   
		<script Language="JavaScript">
		function right(mainStr,lngLen) {
		// alert(mainStr.length)
		if (mainStr.length-lngLen>=0 && mainStr.length>=0 && mainStr.length-lngLen<=mainStr.length) {
		return mainStr.substring(mainStr.length-lngLen,mainStr.length)}
		else{return null}
		}
		
		
		function form_check(){
		if(right(document.form3.file1.value,3)=="exe"){window.alert("不能直接诶发送EXE文件，请压缩后在发送");document.form3.file1.focus();return (false);}
		if(document.form3.file1.value.length<1){window.alert("请选择文件");document.form3.file1.focus();return (false);}
		if(document.form3.tname.value.length<1){window.alert("网页已经过期，请重新登录");return (false);}
		
		
		}
		
		</script>
		
		<!--//////////////////////////////////	 --> 
		<script language="javascript" type="text/javascript">
		var classlist=new Array(); //定义js数组
		<%
		i=1
		Set rs = Conn.Execute("SELECT z.id,z.编号 as zhangbianhao,j.编号 as jiebianhao,j.章次,j.节次  FROM Subjectvar z INNER JOIN subjectvar j ON z.编号 = j.章次  WHERE (z.类别 = '章次') AND (j.类别 = '节次') and  (z.学期='"&Right(request.cookies("nowxueqi"),4)& "') and (z.年级='"&strGrade& "')  and (z.科目='"&strsubject& "')  and  (j.学期='"&Right(request.cookies("nowxueqi"),4)& "') and (j.年级='"&strGrade& "')  and (j.科目='"&strsubject& "')  ORDER BY z.编号")
		While NOT rs.EOF %>
		//使用asp循环填充js数组,三维数组,分别保存栏目的父ID,栏目名称,栏目ID
		
		classlist[<%=i-1%>]=new Array(<%=rs("jiebianhao")%>,"<%=rs("节次")%>","<%=rs("zhangbianhao")%>");
		
		
		<%  i=i+1
		
		rs.MoveNext 
		
		Wend
		rs.Close%>
		
		//一级栏目选择变动触发函数
		
		function getSmallClass()
		{
		var parentid=document.all.zhangci.value;  //获取父栏目的ID
		document.all.jieci.length=0;   //将二级栏目下拉清空
		document.all.jieci.options.add(new Option("","0"))  //添加一个自定义的下拉选项
		for(i=0;i<classlist.length;i++)   //遍历js数组
		{
		
		if(classlist[i][2]==parentid)   //js数组里的选项符合条件(父栏目ID来判断)
		{
		document.all.jieci.options.add(new Option(classlist[i][1],classlist[i][0]))  //添加到二级栏目的下拉选项里
		}
		}
		}
		</script>
		
		<!--//////////////////////////////////	 --> 
		
		      
		
		<form method="post" ENCTYPE="multipart/form-data" name="form3" action="saveMyfile.asp" onSubmit="return form_check();">
		
		
		<div align="center">
		<p>&nbsp;</p>
		<p>&nbsp;</p>
		<p><br>
		
		<table width="60%" align="center" border="0" cellpadding="3"   cellspacing="0"  bordercolor="#6D8DD8">   
		<tr>
		<td width="58" height="36" nowrap class="STYLE1">
		
		<div align="center">
		<input name="tname" type="hidden" class="text" id="tname"  value=<%=tname%> size="5" readonly="true">
		</div></td>
		<td width="162">
		<div align="left">
		<input name="years" type="hidden" class="text" id="years"  value=<%=nowxueqi%> size="18" readonly="true"  style= "width:100px ">
		</div></td>
		<td width="507">
		<div align="left">
		<input name="grade" type="hidden" class="text" id="grade"  value=<%=strGrade%> size="5" readonly="true">
		<input name="subject" type="hidden" class="text" id="subject" value=<%=strsubject%>  readonly="true"  style= "width:100px ">
		<input name="zhouci" type="hidden" class="text" id="zhouci"  value=<%=strzhouci%> size="5" readonly="true">
		<input name="ftype" type="hidden" class="text" id="ftype"  value=<%=ftype%> size="5" readonly="true">
		</div>
		
		<div align="center"></div>                     
		
		<div align="center"></div>
		
		<div align="center"></div></td>
		</tr>
		
		
		<tr>
		<td height="31" nowrap class="STYLE1"><%=tname%></td>
		<td colspan="2" class="STYLE1"><%=strGrade%>&nbsp;&nbsp;<%=strsubject%>&nbsp;&nbsp;<%=ftype%>&nbsp;&nbsp;<%=strzhouci%></td>
		</tr>
		
		<tr>
		<td height="36" nowrap class="STYLE1"><div align="center">章次</div></td>
		<td colspan="2"><span class="STYLE1">
		<select name="zhangci" id="zhangci" style= "width:300px " onChange="getSmallClass();">
		<option></option>
		<%
		'一级栏目通过asp代码的方式加载
		
		
		Set RSsel = Conn.Execute("select * from Subjectvar where  类别='章次' and  学期='"&Right(request.cookies("nowxueqi"),4)& "' and 年级='"&strGrade& "'  and 科目='"&strsubject& "'  order by 编号")
		While NOT RSsel.EOF %>
		<option value=<%=RSsel( "编号" )%>><%=RSsel( "章次" )%></option>
		<% RSsel.MoveNext
		Wend
		RSsel.Close%>
		</select>
		（<a href="Varindex.asp?Grade=<%=strGrade%>&subject=<%=strsubject%>" target="_self">章节设置</a>） </span></td>
		</tr>
		<tr>
		<td height="30" nowrap class="STYLE1"><div align="center">节次</div></td>
		<td colspan="2"><span class="STYLE1">
		<select name="jieci" id="jieci" style= "width:300px ">
		
		</select>
		</span></td>
		</tr>
		<tr>
		<td height="50" nowrap class="STYLE1"><div align="center">关键词><%=sql%></div></td>
		<td colspan="2"><label>
		<textarea name="guanjianci" cols="77" class="text" id="guanjianci"></textarea>
		</label></td>
		</tr>
		<tr>
		<td height="64" nowrap class="STYLE1"><div align="center">附件文件</div></td>
		<td colspan="2"><input name="file1" type="file" class="text" size=70></td>
		</tr>
		</table>
		<p><br>
		</p>
		
		</div>
		<center>
		<input name="button" type="button" class="topanniu" onClick="location='beike.asp?Grade=<%=strGrade%>&subject=<%=strsubject%>&zhouci=<%=strzhouci%>'"  value="不保存返回" />
		&nbsp;&nbsp;&nbsp;&nbsp;
		<input name="submit" type="submit" class="topanniu" value="保存文件"  >
		
		</center>
		</form>
		
		
		</body>  
		
		</html>  


