<script src="http://www.cnblogs.com/js/jquery/jquery.js" type="text/javascript"></script>
<script src="Teacher.js" type="text/javascript"></script>
<script src="http://www.cnblogs.com/js/Ajaxfileupload/ajaxfileupload.js" type="text/javascript"></script>
<script type="text/javascript">
var WeekText = ""; //星期显示框显示值(input)
var WeekValue = ""; //星期显示框value值隐藏字段(input)
var pand = true; //判定是否已经选择
function WeekS(s) {//选择每周工作日期至input
if (s.options[s.selectedIndex].value != -1) {//IF
if (WeekText == "" && WeekValue == "" && pand) {//if
WeekText = WeekText + s.options[s.selectedIndex].text + ",";
WeekValue = WeekValue + s.options[s.selectedIndex].value;
document.getElementById("WeekV").value="";
//为了防止添加和修改的重用。这里把每次进入时的WEEKV都清空再做操作。
document.getElementById("Week").value = WeekText;
document.getElementById("WeekV").value = WeekValue;
//新模块
var divtmp;
var weekLi="One,Two,Third,Four,Five,Six,Seven";
var weekList = new Array();
weekList=weekLi.split(",");//切割出周几 根据 weekList(I+1)如果I从零开始 来取对应的值。
for(divtmp=1;divtmp<8;divtmp++)
{//每次都是某个DIV针对 现在的WEEKV 的所有值来判断是否显示
if(document.getElementById("div"+divtmp).style.display=="block"||document.getElementById("div"+divtmp).style.display=="")
{
var varchard="Begin"+weekList[divtmp-1];
document.getElementById(varchard).value="";
document.getElementById("End"+weekList[divtmp-1]).value="";
document.getElementById("div"+divtmp).style.display="none";//没有的控制为不显示
}
}
document.getElementById("div"+ WeekValue).style.display="block";
}//if
else {
var strs = new Array();
strs = WeekValue.toString();
for (var i = 0; i < strs.length; i++) {
if (s.options[s.selectedIndex].value == strs[i])
{ pand = false; }
}
if (pand) {
WeekText = WeekText + s.options[s.selectedIndex].text + ",";
WeekValue = WeekValue + s.options[s.selectedIndex].value;
document.getElementById("Week").value = WeekText;
document.getElementById("WeekV").value = WeekValue;
document.getElementById("div"+s.options[s.selectedIndex].value).style.display="block";
//新模块
var tmp;var divtmp;
var weekLi="One,Two,Third,Four,Five,Six,Seven";
var weekList = new Array();
weekList=weekLi.split(",");//切割出周几 根据 weekList(I+1)如果I从零开始 来取对应的值。
var strvalue=document.getElementById("WeekV").value;
var strlength=document.getElementById("WeekV").value.length;
for(divtmp=1;divtmp<8;divtmp++){//每次都是某个DIV针对 现在的WEEKV 的所有值来判断是否显示
//该显示的就显示,不该显示的都弄成 display=“none” 然后其内的值用来清空
var panbool=false;
for(tmp=0;tmp<strlength;tmp++){//在其长度内循环
var tttmp=strvalue.substring(tmp,tmp+1);
if(tttmp==divtmp){
panbool=true;//在 所有已选择的里面 此div是被选中的
}
}
if(!panbool){
document.getElementById("div"+divtmp).style.display="none";//没有的控制为不显示
document.getElementById("Begin"+weekList[divtmp-1]).value="";
document.getElementById("End"+weekList[divtmp-1]).value="";
}
}
}
if (!pand) { pand = true; alert("您已经选择,请选择其他日期!"); }
}//else
}//IF
else {
alert("请选择日期!");
}
}
function clearpanW()
{ //清除select,input,隐藏字段
WeekText = "";
WeekValue = "";
var weekLi="One,Two,Third,Four,Five,Six,Seven";
var weekList = new Array();
weekList=weekLi.split(",");
document.getElementById("Week").value = "";
document.getElementById("WeekV").value = "";
document.getElementById("SelectWeek").value = "-1";
var k;
for( k=1;k<8;k++){
document.getElementById("div"+k).style.display="none";
document.getElementById("Begin"+weekList[k-1]).value="";
document.getElementById("End"+weekList[k-1]).value="";
}
}
</script>
<script type="text/javascript">
var dd = ""; //科目显示框显示值(input)
var shuzi = ""; //科目显示框value值隐藏字段(input)
var pand = true; //判定是否已经选择
function aa(s) {
if (s.options[s.selectedIndex].value != -1) {
if (dd == "" && shuzi == "" && pand) {
dd = dd + s.options[s.selectedIndex].text + ",";
shuzi = shuzi + s.options[s.selectedIndex].value + ",";
document.getElementById("subject1").value = dd;
document.getElementById("subject2").value = shuzi;
}
else {
var strs = new Array();
strs = shuzi.split(",");
for (var i = 0; i < strs.length; i++) {
if (s.options[s.selectedIndex].value == strs[i])
{ pand = false; }
}
if (pand) {
dd = dd + s.options[s.selectedIndex].text + ",";
shuzi = shuzi + s.options[s.selectedIndex].value + ",";
document.getElementById("subject1").value = dd;
document.getElementById("subject2").value = shuzi;
}
if (!pand) { pand = true; alert("您已经选择,请选择其他的"); }
}
} else {
alert("请选择科目类型!");
}
}
function clearpan() {//清除select,input,隐藏字段
dd = "";
shuzi = "";
document.getElementById("subject1").value = "";
document.getElementById("subject2").value = "";
document.getElementById("subject").value = "-1";
}
</script>
<script type="text/javascript">
function checkPicture()//表单提交时验证
{
if (!isFileType("houseMaps")) {
alert("必须上传图片格式文件!");
document.getElementById("houseMaps").focus();
return false;
}
return true;
}
function ajaxFileUpload() {
if (checkPicture()) {
$("#loading")
.ajaxStart(function() {
$(this).show();
})
.ajaxComplete(function() {
$(this).hide();
});
var fileName = document.getElementById("houseMaps").value;
$.ajaxFileUpload(
{
url: "uploadfile.aspx?FileName=" + fileName + "", //需要链接到服务器地址
secureuri: false,
fileElementId: 'houseMaps', //文件选择框的id属性
dataType: 'json', //服务器返回的格式,可以是json
success: function(data, status) //相当于java中try语句块的用法
{
$("#result").append(data.result);
document.getElementById("photo").src = data.fileAddrss;
document.getElementById("addrPhoto").value = data.fileAddrss;
$("#upfile").hide();
},
error: function(data, status, e) //相当于java中catch语句块的用法
{
$("#result").append(data.result);
}
}
);
}
}
</script>
<script type="text/javascript">
$(document).ready(
function() {
loadDics("subject", document.getElementById("LoadSubject").value, "../Dics/LoadDics.aspx", "D_Subject"); //加载科目字典表
}
);
</script>
</head>
<body>
<input id="addrPhoto" runat="server" type="hidden" />
<input id="LoadSubject" runat="server" type="hidden" />
<input id="Id" runat="server" type="hidden" />
<input id="subject2" runat="server" type="hidden" />
<input id="WeekV" runat="server" type="hidden" />
<div style="height: 590px; width: 85%; margin: 0 auto">
<input id="PersonnelId" type="hidden" runat="server" />
<table width="100%" class="maintable" cellpadding="0" cellspacing="1" border="1">
<tr>
<td class="title" colspan="4">
教师用户信息 (带<font class="nf1">*</font>为必填)
</td>
</tr>
<tr>
<td colspan="4" align="center">
<img src='http://www.cnblogs.com/App_Themes/images/nopic.gif' alt='' id='photo' runat="server" style="width: 150px;
height: 150px" />
</td>
</tr>
<tr>
<td colspan="4" class="center ">
教师照片
<input runat="server" type="file" id="houseMaps" name="houseMaps" /> <img src="http://www.cnblogs.com/js/Ajaxfileupload/loading.gif"
id="loading" alt="上传进度" style="display: none;" />
<input runat="server" type="button" value="上传" id="upfile" onclick="ajaxFileUpload()"
class="buttonBlue" />
</td>
</tr>
<tr>
<td class="left" width="20%">
教师简介
</td>
<td class="center" colspan="4" width="30%">
<textarea runat="server" id="Introduce" rows="10" cols="70"></textarea>
<font color="red">*</font>
</td>
</tr>
<tr>
<td class="left" width="20%">
培训科目
</td>
<td>
<select id="subject" runat="server" onchange="aa(this);">
</select><input type="button" style="height: 20px" value="清空" onclick="clearpan();" />
<input id="subject1" runat="server" style="width: 180px" onkeydown="alert('请选择清空!');return false;"
readonly /><font color="red">*</font>
</td>
<td class="left">
每周工作日期
</td>
<td class="right">
<select id="SelectWeek" runat="server" onchange="WeekS(this);">
<option value="-1">--请选择--</option>
<option value="1">周1</option>
<option value="2">周2</option>
<option value="3">周3</option>
<option value="4">周4</option>
<option value="5">周5</option>
<option value="6">周6</option>
<option value="7">周7</option>
</select><input type="button" style="height: 20px" value="清空" onclick="clearpanW();" />
<input id="Week" style="width: 180px" runat="server" onkeydown="alert('请选择清空!');return false;" /><font
color="red">*</font>
</td>
</tr>
</table>
<div></div>
<div id="div1" style="display: none; width: 100%; margin: 0 auto" runat="server">
<table width="100%" class="maintable" cellpadding="0" cellspacing="1" border="1">
<tr id="Monday" runat="server">
<td class="left" width="20%">
周一工作起始时间
</td>
<td class="right" width="30%">
<input runat="server" id="BeginOne" type="text" maxlength="25" style="width: 33px"
onclick="WdatePicker({startDate:'00:00',dateFmt:'HH:mm',alwaysUseStartDate:true})"
readonly="readonly" />
<font color="red">*</font>
</td>
<td class="left" width="20%">
周一工作截止时间
</td>
<td class="right" width="30%">
<input runat="server" id="EndOne" style="width: 33px" type="text" onclick="WdatePicker({startDate:'00:00',dateFmt:'HH:mm',alwaysUseStartDate:true})" />
<font color="red">*</font>
</td>
</tr>
</table>
</div>
<div id="div2" style="display: none; width: 100%; margin: 0 auto" runat="server">
<table width="100%" class="maintable" cellpadding="0" cellspacing="1" border="1">
<tr id="Tuesday" runat="server">
<td class="left" width="20%">
周二工作起始时间
</td>
<td class="right" width="30%">
<input runat="server" id="BeginTwo" type="text" maxlength="25" style="width: 33px"
onclick="WdatePicker({startDate:'00:00',dateFmt:'HH:mm',alwaysUseStartDate:true})"
readonly="readonly" />
<font color="red">*</font>
</td>
<td class="left" width="20%">
周二工作截止时间
</td>
<td class="right" width="30%">
<input runat="server" id="EndTwo" style="width: 33px" type="text" onclick="WdatePicker({startDate:'00:00',dateFmt:'HH:mm',alwaysUseStartDate:true})" />
<font color="red">*</font>
</td>
</tr>
</table>
</div>
<div id="div3" style="display: none; width: 100%; margin: 0 auto" runat="server">
<table width="100%" class="maintable" cellpadding="0" cellspacing="1" border="1">
<tr id="Wendnesday" runat="server">
<td class="left" width="20%">
周三工作起始时间
</td>
<td class="right" width="30%">
<input runat="server" id="BeginThird" type="text" maxlength="25" style="width: 33px"
onclick="WdatePicker({startDate:'00:00',dateFmt:'HH:mm',alwaysUseStartDate:true})"
readonly="readonly" />
<font color="red">*</font>
</td>
<td class="left" width="20%">
周三工作截止时间
</td>
<td class="right" width="30%">
<input runat="server" id="EndThird" style="width: 33px" type="text" onclick="WdatePicker({startDate:'00:00',dateFmt:'HH:mm',alwaysUseStartDate:true})" />
<font color="red">*</font>
</td>
</tr>
</table>
</div>
<div id="div4" style="display: none; width: 100%; margin: 0 auto" runat="server">
<table width="100%" class="maintable" cellpadding="0" cellspacing="1" border="1">
<tr id="Thursday" runat="server">
<td class="left" width="20%">
周四工作起始时间
</td>
<td class="right" width="30%">
<input runat="server" id="BeginFour" type="text" maxlength="25" style="width: 33px"
onclick="WdatePicker({startDate:'00:00',dateFmt:'HH:mm',alwaysUseStartDate:true})"
readonly="readonly" />
<font color="red">*</font>
</td>
<td class="left" width="20%">
周四工作截止时间
</td>
<td class="right" width="30%">
<input runat="server" id="EndFour" style="width: 33px" type="text" onclick="WdatePicker({startDate:'00:00',dateFmt:'HH:mm',alwaysUseStartDate:true})" />
<font color="red">*</font>
</td>
</tr>
</table>
</div>
<div id="div5" style="display: none; width: 100%; margin: 0 auto" runat="server">
<table width="100%" class="maintable" cellpadding="0" cellspacing="1" border="1">
<tr id="Friday" runat="server">
<td class="left" width="20%">
周五工作起始时间
</td>
<td class="right" width="30%">
<input runat="server" id="BeginFive" type="text" maxlength="25" style="width: 33px"
onclick="WdatePicker({startDate:'00:00',dateFmt:'HH:mm',alwaysUseStartDate:true})"
readonly="readonly" />
<font color="red">*</font>
</td>
<td class="left" width="20%">
周五工作截止时间
</td>
<td class="right" width="30%">
<input runat="server" id="EndFive" style="width: 33px" type="text" onclick="WdatePicker({startDate:'00:00',dateFmt:'HH:mm',alwaysUseStartDate:true})" />
<font color="red">*</font>
</td>
</tr>
</table>
</div>
<div id="div6" style="display: none; width: 100%; margin: 0 auto" runat="server">
<table width="100%" class="maintable" cellpadding="0" cellspacing="1" border="1">
<tr id="Saturday" runat="server">
<td class="left" width="20%">
周六工作起始时间
</td>
<td class="right" width="30%">
<input runat="server" id="BeginSix" type="text" maxlength="25" style="width: 33px"
onclick="WdatePicker({startDate:'00:00',dateFmt:'HH:mm',alwaysUseStartDate:true})"
readonly="readonly" />
<font color="red">*</font>
</td>
<td class="left" width="20%">
周六工作截止时间
</td>
<td class="right" width="30%">
<input runat="server" id="EndSix" style="width: 33px" type="text" onclick="WdatePicker({startDate:'00:00',dateFmt:'HH:mm',alwaysUseStartDate:true})" />
<font color="red">*</font>
</td>
</tr>
</table>
</div>
<div id="div7" style="display: none; width: 100%; margin: 0 auto" runat="server">
<table width="100%" class="maintable" cellpadding="0" cellspacing="1" border="1">
<tr id="Sunday" runat="server">
<td class="left" width="20%">
周日工作起始时间
</td>
<td class="right" width="30%">
<input runat="server" id="BeginSeven" type="text" maxlength="25" style="width: 33px"
onclick="WdatePicker({startDate:'00:00',dateFmt:'HH:mm',alwaysUseStartDate:true})"
readonly="readonly" />
<font color="red">*</font>
</td>
<td class="left" width="20%">
周日工作截止时间
</td>
<td class="right" width="30%">
<input runat="server" id="EndSeven" style="width: 33px" type="text" onclick="WdatePicker({startDate:'00:00',dateFmt:'HH:mm',alwaysUseStartDate:true})" />
<font color="red">*</font>
</td>
</tr>
</table>
</div>
<div style="width: 100%; margin: 0 auto" runat="server">
<table width="100%" class="maintable" cellpadding="0" cellspacing="1" border="1">
<tr>
<td colspan="4" align="center" class="bottom" style="width: 100%; margin: 0 auto">
<input type="submit" id="save" class="buttonBlue" runat="server" value="保 存" />
<input type="submit" id="cancel" value="重 置" class="buttonBlue" onclick="reset();" />
</td>
</tr>
</table>
</div>
</div>
for(var weekworkday=1;weekworkday<8;weekworkday++){
if (document.getElementById("div"+weekworkday).style.display!="none"){
switch(weekworkday)
{
case 1:
zhouji="周一";
tod="One";
break;
case 2:
zhouji="周二";
tod="Two";
break;
case 3:
zhouji="周三";
tod="Third";
break;
case 4:
zhouji="周四";
tod="Four";
break;
case 5:
zhouji="周五";
tod="Five";
break;
case 6:
zhouji="周六";
tod="Six";
break;
case 7:
zhouji="周日";
tod="Seven";
break;
default:
break;
}
var Bweekday="Begin"+tod;
var Eweekday= "End"+tod;
if (isNull(Bweekday)) {
alert(""+zhouji+"起始工作时间不能为空!");
document.getElementById(Bweekday).focus();
return false;
}
if (isNull(Eweekday)) {
alert(""+zhouji+"截止工作时间不能为空!");
document.getElementById(Eweekday).focus();
return false;
}
if (document.getElementById(Bweekday).value > document.getElementById(Eweekday).value) {
alert(""+zhouji+"起始工作时间不得晚于截止工作时间!");
document.getElementById(Bweekday).focus();
return false;
}
}
}
return true;
}