function submitData()
{
var subIds="";
var subValues="";
var arrFeatures=new Array();
var num = 0;
var ids = document.getElementsByName("theFeatures");
for(var i=0;i<ids.length; i++)
{
if(i==0){
subIds += ids[i].id;
subValues += ids[i].value;
}
else
{
subIds += ","+ids[i].id;
subValues += ","+ids[i].value;
}
arrFeatures[num++]=ids[i].value;
if(ids[i].value=="")
{
document.getElementById("jsmsg").innerHTML="修改的功能类别不能为空!";
return false;
}
}
featuresForm.elements("features.subIds").value = subIds;
featuresForm.elements("features.subValues").value = subValues;
var str = "";
var nameValue = "";
var nameValueTemp = "";
var ele = document.getElementsByName("featuresName");
var arr=new Array();
var count = 0;
for(var i=0;i<ele.length; i++)
{
if(ele[i].value!="")
{
arr[count++]=ele[i].value;
nameValue += ele[i].value+ ",";
}
}
for(i=0;i<arr.length-1;i++)
{
for(j=i+1;j<arr.length;j++)
{
if(arr[i]==arr[j])
{
document.getElementById("jsmsg").innerHTML="不能有重复的功能类别!";
return false;
}
}
}
featuresForm.elements("features.nameStr").value = nameValue;
featuresForm.action="<c:out value="${ctx}"/>/system/features.do?method=update&ec_p=<c:out value="${ec_p}"/>";
featuresForm.submit();
}
function addFeaturesRow(e,trid,tbid)
{
var tr_cur=$(trid),tb_cur=$(tbid);
// alert(tr_cur.rowIndex);
var newTR = tb_cur.insertRow(tr_cur.rowIndex);
//alert(newTR.nodeName); return; insertRow插入一行, rowIndex当前行的索引,0开始。
var newTD1=newTR.insertCell(0); //插入单元格
var newTD2=newTR.insertCell(1);
newTD1.innerHTML=tr_cur.cells[0].innerHTML="Features Type";
newTD2.innerHTML='<input type= "text" name="featuresName" size="60" maxlength="200"/> <A href="#" onClick="deleteTheRow(event,\'contentTB\');sortTable();"><IMG height="15" alt="Delete Row" src="<c:out value="${ctx}"/>/images/saveDelete.gif" width="15" align="absMiddle" border="0"></A>';
newTD1.className=tr_cur.cells[0].className;
newTD2.className=tr_cur.cells[1].className; //alert(tr_cur.cells[1].innerHTML.replace('24','54'));
}
function deleteTheRow(e,tbId)
{
var table=$(tbId);
var eventobj=eventMatchObj(e);
var cur_tr=eventobj.parentNode;
while(cur_tr.nodeName!="TR"){ //这样可以找到元素所在的行
cur_tr=cur_tr.parentNode;
}
if(table.rows.length>1)
{
table.deleteRow(cur_tr.rowIndex); //deleteTheRow 删除行 cur_tr.rowIndex>0保证还有两行。
}
}
{
var subIds="";
var subValues="";
var arrFeatures=new Array();
var num = 0;
var ids = document.getElementsByName("theFeatures");
for(var i=0;i<ids.length; i++)
{
if(i==0){
subIds += ids[i].id;
subValues += ids[i].value;
}
else
{
subIds += ","+ids[i].id;
subValues += ","+ids[i].value;
}
arrFeatures[num++]=ids[i].value;
if(ids[i].value=="")
{
document.getElementById("jsmsg").innerHTML="修改的功能类别不能为空!";
return false;
}
}
featuresForm.elements("features.subIds").value = subIds;
featuresForm.elements("features.subValues").value = subValues;
var str = "";
var nameValue = "";
var nameValueTemp = "";
var ele = document.getElementsByName("featuresName");
var arr=new Array();
var count = 0;
for(var i=0;i<ele.length; i++)
{
if(ele[i].value!="")
{
arr[count++]=ele[i].value;
nameValue += ele[i].value+ ",";
}
}
for(i=0;i<arr.length-1;i++)
{
for(j=i+1;j<arr.length;j++)
{
if(arr[i]==arr[j])
{
document.getElementById("jsmsg").innerHTML="不能有重复的功能类别!";
return false;
}
}
}
featuresForm.elements("features.nameStr").value = nameValue;
featuresForm.action="<c:out value="${ctx}"/>/system/features.do?method=update&ec_p=<c:out value="${ec_p}"/>";
featuresForm.submit();
}
function addFeaturesRow(e,trid,tbid)
{
var tr_cur=$(trid),tb_cur=$(tbid);
// alert(tr_cur.rowIndex);
var newTR = tb_cur.insertRow(tr_cur.rowIndex);
//alert(newTR.nodeName); return; insertRow插入一行, rowIndex当前行的索引,0开始。
var newTD1=newTR.insertCell(0); //插入单元格
var newTD2=newTR.insertCell(1);
newTD1.innerHTML=tr_cur.cells[0].innerHTML="Features Type";
newTD2.innerHTML='<input type= "text" name="featuresName" size="60" maxlength="200"/> <A href="#" onClick="deleteTheRow(event,\'contentTB\');sortTable();"><IMG height="15" alt="Delete Row" src="<c:out value="${ctx}"/>/images/saveDelete.gif" width="15" align="absMiddle" border="0"></A>';
newTD1.className=tr_cur.cells[0].className;
newTD2.className=tr_cur.cells[1].className; //alert(tr_cur.cells[1].innerHTML.replace('24','54'));
}
function deleteTheRow(e,tbId)
{
var table=$(tbId);
var eventobj=eventMatchObj(e);
var cur_tr=eventobj.parentNode;
while(cur_tr.nodeName!="TR"){ //这样可以找到元素所在的行
cur_tr=cur_tr.parentNode;
}
if(table.rows.length>1)
{
table.deleteRow(cur_tr.rowIndex); //deleteTheRow 删除行 cur_tr.rowIndex>0保证还有两行。
}
}