<
script type
=
"
text/javascript
"
language
=
"
javascript
"
>
// 移动排序
function Move(part)
... {
var count= document.getElementById('HidCount').value;
var temp=0;
var index=0;
var indexid=0
for( i=0 ;i<=count;i++)
...{
var bc=document.getElementById('GVLesson_Row_'+i).style.backgroundColor;
if(bc=='#f8e0e0')
...{
index=document.getElementById('GVLesson_Row_'+i).rowIndex;
indexid=i;
//alert("GoUp "+index);
temp=temp+1;
}
}
if(temp<0||temp>1)
...{
alert("只能选择一节课程!");
return;
}
//上移
if(part=='U')
...{
if(index==1)
...{
alert("第一行无法上移!");
return;
}
GVLesson.rows[index-1].swapNode(GVLesson.rows[index]);
for(obj in GVLesson.rows[index-1].cells[0].children)
...{
document.form1.elements[obj].checked='checked';
}
//得到单一列的索引
// var tempaa=GVLesson.rows[index-1].cells[2];
//
// alert(tempaa.innerHTML)
// for(i=0;i<tempaa.childNodes.length;i++)
// {
// if(tempaa.childNodes[i].tagName=="INPUT")
// {
// alert(tempaa.childNodes[i].value);
// alert(document.getElementById('GVLesson_Row_'+tempaa.childNodes[i].value+'_Hid_index').value);
// }
// }
//
}
else//下移
...{
if(index-1 == count)
...{
alert("最后一行无法下移!");
return;
}
GVLesson.rows[index+1].swapNode(GVLesson.rows[index]);
for(obj in GVLesson.rows[index+1].cells[0].children)
...{
document.form1.elements[obj].checked='checked';
}
}
}
var indexID = "" ;
var indexValue = "" ;
// 保存排序
function saveTaxis()
... {
var indexcount=GVLesson.rows.length;//表总行数
//alert(indexcount);
for(i=1;i<indexcount;i++)//客户端课程表
...{
var tempaa=GVLesson.rows[i].cells[2];
indexID = indexID + i + ",";
//alert(tempaa.innerHTML)
for(t=0;t<tempaa.childNodes.length;t++)
...{
if(tempaa.childNodes[t].tagName=="INPUT")
...{
//alert(tempaa.childNodes[t ].value);//得到隐藏域的值
indexValue = indexValue + tempaa.childNodes[t ].value + ",";
}
}
}
//alert(indexID);
//alert(indexValue);
AjaxRequestobj();
}
// 使用Ajax保存排序。
function AjaxRequestobj()
... {
alert(indexID);
alert(indexValue);
var code="";
var http_request = false;
if (window.XMLHttpRequest) ...{ // Mozilla, Safari,...
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) ...{
http_request.overrideMimeType('text/xml');
}
} else if (window.ActiveXObject) ...{ // IE
try ...{
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) ...{
try ...{
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) ...{}
}
}
if (!http_request) ...{
alert('Giving up :( Cannot create an XMLHTTP instance');
return false;
}
else
...{
http_request.open("GET","TeacherLesson.aspx?ID=" + indexID + "&VL=" + indexValue,true);
http_request.send();
if (http_request.readyState == 4)
...{
if (http_request.status == 200)
...{
alert(http_request.responseText);
code=http_request.responseText;
if(code=="1")
window.location.reload();
else
alert("操作失败请重试!");
}
else
window.location.reload();
}
else
window.location.reload();
}
}
</ script >
后台代码:
private void AjaxRequest()
... {
string ID = Request["ID"].ToString();
string VL = Request["VL"].ToString();
string[] IndexID = ID.Split(',');
string[] IndexValue = VL.Split(',');
bool test = true;
for (int i = 1; i < IndexID.Length; i++)
...{
if (!new FCD_Lesson().Updata_LessonTaxis(Convert.ToInt32(IndexValue[i - 1].ToString()), Convert.ToInt32(IndexID[i - 1].ToString())))
...{
test = false;
break;
}
}
if(test)
Response.Write("1");
else
Response.Write("0");
Response.Flush();
Response.End();
}
// 移动排序
function Move(part)
... {
var count= document.getElementById('HidCount').value;
var temp=0;
var index=0;
var indexid=0
for( i=0 ;i<=count;i++)
...{
var bc=document.getElementById('GVLesson_Row_'+i).style.backgroundColor;
if(bc=='#f8e0e0')
...{
index=document.getElementById('GVLesson_Row_'+i).rowIndex;
indexid=i;
//alert("GoUp "+index);
temp=temp+1;
}
}
if(temp<0||temp>1)
...{
alert("只能选择一节课程!");
return;
}
//上移
if(part=='U')
...{
if(index==1)
...{
alert("第一行无法上移!");
return;
}
GVLesson.rows[index-1].swapNode(GVLesson.rows[index]);
for(obj in GVLesson.rows[index-1].cells[0].children)
...{
document.form1.elements[obj].checked='checked';
}
//得到单一列的索引
// var tempaa=GVLesson.rows[index-1].cells[2];
//
// alert(tempaa.innerHTML)
// for(i=0;i<tempaa.childNodes.length;i++)
// {
// if(tempaa.childNodes[i].tagName=="INPUT")
// {
// alert(tempaa.childNodes[i].value);
// alert(document.getElementById('GVLesson_Row_'+tempaa.childNodes[i].value+'_Hid_index').value);
// }
// }
//
}
else//下移
...{
if(index-1 == count)
...{
alert("最后一行无法下移!");
return;
}
GVLesson.rows[index+1].swapNode(GVLesson.rows[index]);
for(obj in GVLesson.rows[index+1].cells[0].children)
...{
document.form1.elements[obj].checked='checked';
}
}
}
var indexID = "" ;
var indexValue = "" ;
// 保存排序
function saveTaxis()
... {
var indexcount=GVLesson.rows.length;//表总行数
//alert(indexcount);
for(i=1;i<indexcount;i++)//客户端课程表
...{
var tempaa=GVLesson.rows[i].cells[2];
indexID = indexID + i + ",";
//alert(tempaa.innerHTML)
for(t=0;t<tempaa.childNodes.length;t++)
...{
if(tempaa.childNodes[t].tagName=="INPUT")
...{
//alert(tempaa.childNodes[t ].value);//得到隐藏域的值
indexValue = indexValue + tempaa.childNodes[t ].value + ",";
}
}
}
//alert(indexID);
//alert(indexValue);
AjaxRequestobj();
}
// 使用Ajax保存排序。
function AjaxRequestobj()
... {
alert(indexID);
alert(indexValue);
var code="";
var http_request = false;
if (window.XMLHttpRequest) ...{ // Mozilla, Safari,...
http_request = new XMLHttpRequest();
if (http_request.overrideMimeType) ...{
http_request.overrideMimeType('text/xml');
}
} else if (window.ActiveXObject) ...{ // IE
try ...{
http_request = new ActiveXObject("Msxml2.XMLHTTP");
} catch (e) ...{
try ...{
http_request = new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) ...{}
}
}
if (!http_request) ...{
alert('Giving up :( Cannot create an XMLHTTP instance');
return false;
}
else
...{
http_request.open("GET","TeacherLesson.aspx?ID=" + indexID + "&VL=" + indexValue,true);
http_request.send();
if (http_request.readyState == 4)
...{
if (http_request.status == 200)
...{
alert(http_request.responseText);
code=http_request.responseText;
if(code=="1")
window.location.reload();
else
alert("操作失败请重试!");
}
else
window.location.reload();
}
else
window.location.reload();
}
}
</ script >
后台代码:
private void AjaxRequest()
... {
string ID = Request["ID"].ToString();
string VL = Request["VL"].ToString();
string[] IndexID = ID.Split(',');
string[] IndexValue = VL.Split(',');
bool test = true;
for (int i = 1; i < IndexID.Length; i++)
...{
if (!new FCD_Lesson().Updata_LessonTaxis(Convert.ToInt32(IndexValue[i - 1].ToString()), Convert.ToInt32(IndexID[i - 1].ToString())))
...{
test = false;
break;
}
}
if(test)
Response.Write("1");
else
Response.Write("0");
Response.Flush();
Response.End();
}