日期:2014-05-16  浏览次数:20378 次

增加文本输入框的JS
增加文本输入框的JS
<html>
<head>
<script type="text/javascript">
var index;
function next(){
if(Validator.Validate(document.getElementById('mobileParamForm'),1)){
collectAttach();
mobileParamForm.submit();
}
}
//提交所有信息
function collectAttach()
{
  var trs=ParamConf.rows.length;
  var paramName ="";
  var paramValue = "";
  var description = "";
  var paramId = "";
  for(i=1;i<trs;i++)
  {
    inputs = ParamConf.rows[i].getElementsByTagName("input");
    for(j=0;j<=3;j++)
    {
      bb = inputs[j].value;
  //参数名称
      if(inputs[j].id.indexOf("paramName") != -1){
        paramName += bb + ",";
      }
      //参数值
      if(inputs[j].id.indexOf("paramValue") != -1){
        paramValue += bb + ",";
      }
      //描述
      if(inputs[j].id.indexOf("description") != -1){
        description += bb + ",";    
      }
      if(inputs[j].id == "paramId"){
      paramId += bb + ",";
     }
    }
  }
 
  mobileParamForm.paramNames.value=paramName;
  mobileParamForm.paramValues.value = paramValue;
  mobileParamForm.descriptions.value = description;
  mobileParamForm.paramIds.value = paramId;
}

//新增一条参数信息
index = 2;
function addParamConf(){
  s1 = "<input class='style1' id='paramName"+index+"' dataType='Require' msg='参数名称不允许为空' type='text'  style='width:100%' value=''>";
  s2 = "<input class='style1' id='paramValue"+index+"' dataType='Require' msg='参数值不允许为空' type='text' style='width:100%' value=''>";
  s3 = "<input class='style1' id='description"+index+"' type='text' style='width:100%' value=''>";
  s4 = "<a href=javascript:deleteParamConf('"+index+"')>删除</a>";
  s5 = "<input class='style1' id='paramId' type='hidden' style='width:100%' value=''>";
  arow = ParamConf.insertRow();
  arow.id="ParamConf"+index;
  c1 = arow.insertCell();
  c1.align="center";
  c1.className='td_rb';
  c1.innerHTML=s1;
 
  c2 = arow.insertCell();
  c2.align="center";
  c2.className='td_rb';
  c2.innerHTML=s2;
 
  c3 = arow.insertCell();
  c3.align="center";
  c3.className='td_rb';
  c3.innerHTML=s3;
 
  c4 = arow.insertCell();
  c4.align="center";
  c4.className='td_rb';
  c4.innerHTML=s4;

 
  c5 = arow.insertCell();
  c5.align="center";
  c5.className='td_rb';
  c5.innerHTML=s5;
 
  index = index+1;
   //window_resize();
//initWindow(true);
}
//删除行
function deleteParamConf(index){
  if(window.confirm('确定要删除这条记录吗?')){
ParamConf.deleteRow(document.getElementById("ParamConf"+index).rowIndex);
this.index = this.index - 1;
  window_resize();
  }
}


</script>


<title>147</title>
</head>
<body>
<table id="ParamConf" name="ParamConf" align="center" width="100%" border="1" style="border-collap