日期:2014-05-18  浏览次数:20869 次

请高手指点关于添加一行记录的问题
这是我从网上粘的代码。我想把部门一列变为下拉菜单,并且还想再后面多加几列,我该怎么改呢?

<%@ page contentType="text/html; charset=gb2312" %>
<html>
<head>

  <script language="javascript" id="clientEventHandlersJS0">
<!--
var tLinkmanNowRowIndex
var var_rowIndex

iNowRowIndex=-1
tLinkmanNowRowIndex=-1
var_rowIndex=0

function btnAddLinkman_onclick() {
 var newRow = tLinkman.insertRow();
// newRow.bgColor='#efefef';
 var newCell0 = newRow.insertCell();
 newCell0.className='table_body';
 newCell0.width = '40';
 newCell0.align = 'center';
 var iRowLength = tLinkman.rows.length; 
 newCell0.innerText = iRowLength - 1 ;
 var newCell1 = newRow.insertCell();
 newCell1.className='table_body';
// newCell1.width = '16%';
 newCell1.innerHTML = "<input type=text class=textfield id=linkmanName" + (iRowLength-1) + " >";
 var newCell2 = newRow.insertCell();
 newCell2.className='table_body';
 newCell2.width = '16%';
 newCell2.innerHTML = "<input type=text class=textfield id=linkmanPhone" + (iRowLength-1) + " >";  
 newCell3.width = '16%';
 newCell3.innerHTML = "<input type=text class=textfield id=linkmandizhi" + (iRowLength-1) + " >";  
}

function btnDelRow_onclick(tablename) {
var itemp
itemp =-1


 if ((eval(tablename + "NowRowIndex") + 1)>1)
 {
  itemp = eval(tablename+"NowRowIndex")
 }
 else
 {
  itemp = eval(tablename).rows.length -1
 }


 if (itemp >0)
 {
  if (confirm("确定要" + event.srcElement.value + " " + itemp +" 吗?"))
  { 
  eval(tablename).deleteRow(itemp)
  for (i=1;i<eval(tablename).rows.length;i++)
  eval(tablename).rows[i].cells[0].innerText = i
  }
 }
// if (tableName=="tLinkman")
  tLinkmanNowRowIndex = -1
}

function getRow(e)
{
event.cancellBulle=true
var itemp;
var tableName
var iNowRowIndex

itemp=-1
tableName=""
iNowRowIndex = -1
 if (event.srcElement.tagName.toLowerCase() == "td")
 {
  iNowRowIndex = event.srcElement.parentElement.rowIndex ;
  tableName = event.srcElement.parentElement.parentElement.parentElement.id.toString()
 }
 if (event.srcElement.tagName.toLowerCase() == "input")
 {
  iNowRowIndex = event.srcElement.parentElement.parentElement.rowIndex;
  tableName = event.srcElement.parentElement.parentElement.parentElement.parentElement.id.toString()
// alert(tableName)
 }
 
 itemp = eval(tableName + "NowRowIndex")
 if (itemp > 0)
 {
  eval(tableName).rows[itemp].bgColor = '#ffffff';
  eval(tableName).rows[itemp].cells[0].innerText = itemp
 }
 if(iNowRowIndex > -1)
 {
  if(iNowRowIndex > 0)
  {
  eval(tableName).rows[iNowRowIndex].cells[0].innerHTML = '<font color=blue>&#9658</font>'  
  eval(tableName).rows[iNowRowIndex].bgColor = '#efefef'
  }
  if (tableName=="tLinkman")
  tLinkmanNowRowIndex = iNowRowIndex
 }
}
//-->
  </script>

</head>
<body>
  <input language="javascript&qu