<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Untitled Document</title>
<script language="javascript">
function Add(){
if(dltLocation.selectedIndex==-1) {alert("请选择地点!");return;};
if(dltEducation.selectedIndex==-1) {alert("请选择学历!");return;};
if(dltMoney.selectedIndex==-1) {alert("请选择钱数!");return;};
var newRow=tbCondition.insertRow(0);
newRow.insertCell();
newRow.insertCell();
newRow.insertCell();
alert(dltLocation.value);
newRow.cells[0].innerText=dltLocation.value;
newRow.cells[1].innerText=dltEducation.value;
newRow.cells[2].innerText=dltMoney.value;
}
function Delete(){
//功能比较简单,自己写吧
}
</script>
</head>
<body>
<table width="450" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="150"><select name="dltLocation" id="dltLocation" multiple size="6" style="width:100% ">
<option value="北京">北京</option>
<option value="广州">广州</option>
</select></td>
<td width="150"><select name="dltEducation" id="dltEducation" multiple size="6" style="width:100% ">
<option value="本科">本科</option>
<option value="专科">专科</option>
</select></td>
<td width="150"><select name="dltMoney" id="dltMoney" multiple size="6" style="width:100% ">
<option value="1000">1000</option>
<option value="2000">2000</option>
<option value="3000">3000</option>
</select></td>
</tr>
<tr>
<td colspan="3">
<table id="tbCondition" width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</td>
</tr>
</table>
<tr>
<td align="right"><input name="btnAdd" type="button" value="添加" onClick="Add()"></td>
<td> </td>
<td><input name="btnDelete" type="button" value="删除" onClick="Delete()"></td>
</tr>
</body>
</html>
求助内容::怎么删除下面表里的指定一行!!!十分感谢!!
2 个解决方案
#1
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Untitled Document</title>
<script language="javascript">
function Add(){
if(dltLocation.selectedIndex==-1) {alert("请选择地点!");return;};
if(dltEducation.selectedIndex==-1) {alert("请选择学历!");return;};
if(dltMoney.selectedIndex==-1) {alert("请选择钱数!");return;};
var newRow=tbCondition.insertRow(0);
newRow.insertCell();
newRow.insertCell();
newRow.insertCell();
newRow.insertCell();
alert(dltLocation.value);
newRow.cells[0].innerText=dltLocation.value;
newRow.cells[1].innerText=dltEducation.value;
newRow.cells[2].innerText=dltMoney.value;
newRow.cells[3].innerHTML='<input type="button" value="删除" onclick="this.parentNode.parentNode.removeNode(true)">';
}
function Delete(){
//功能比较简单,自己写吧
}
</script>
</head>
<body>
<table width="450" border="1" cellspacing="0" cellpadding="0" ID="Table1">
<tr>
<td width="150"><select name="dltLocation" id="dltLocation" multiple size="6" style="width:100% ">
<option value="北京">北京</option>
<option value="广州">广州</option>
</select></td>
<td width="150"><select name="dltEducation" id="dltEducation" multiple size="6" style="width:100% ">
<option value="本科">本科</option>
<option value="专科">专科</option>
</select></td>
<td width="150"><select name="dltMoney" id="dltMoney" multiple size="6" style="width:100% ">
<option value="1000">1000</option>
<option value="2000">2000</option>
<option value="3000">3000</option>
</select></td>
</tr>
<tr>
<td align="right" colspan="3"><input name="btnAdd" type="button" value="添加" onClick="Add()" ID="Button1"></td>
</tr>
<tr>
<td colspan="3">
<table id="tbCondition" width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Untitled Document</title>
<script language="javascript">
function Add(){
if(dltLocation.selectedIndex==-1) {alert("请选择地点!");return;};
if(dltEducation.selectedIndex==-1) {alert("请选择学历!");return;};
if(dltMoney.selectedIndex==-1) {alert("请选择钱数!");return;};
var newRow=tbCondition.insertRow(0);
newRow.insertCell();
newRow.insertCell();
newRow.insertCell();
newRow.insertCell();
alert(dltLocation.value);
newRow.cells[0].innerText=dltLocation.value;
newRow.cells[1].innerText=dltEducation.value;
newRow.cells[2].innerText=dltMoney.value;
newRow.cells[3].innerHTML='<input type="button" value="删除" onclick="this.parentNode.parentNode.removeNode(true)">';
}
function Delete(){
//功能比较简单,自己写吧
}
</script>
</head>
<body>
<table width="450" border="1" cellspacing="0" cellpadding="0" ID="Table1">
<tr>
<td width="150"><select name="dltLocation" id="dltLocation" multiple size="6" style="width:100% ">
<option value="北京">北京</option>
<option value="广州">广州</option>
</select></td>
<td width="150"><select name="dltEducation" id="dltEducation" multiple size="6" style="width:100% ">
<option value="本科">本科</option>
<option value="专科">专科</option>
</select></td>
<td width="150"><select name="dltMoney" id="dltMoney" multiple size="6" style="width:100% ">
<option value="1000">1000</option>
<option value="2000">2000</option>
<option value="3000">3000</option>
</select></td>
</tr>
<tr>
<td align="right" colspan="3"><input name="btnAdd" type="button" value="添加" onClick="Add()" ID="Button1"></td>
</tr>
<tr>
<td colspan="3">
<table id="tbCondition" width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
#2
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Untitled Document</title>
<script language="javascript">
function Add(){
if(dltLocation.selectedIndex==-1) {alert("请选择地点!");return;};
if(dltEducation.selectedIndex==-1) {alert("请选择学历!");return;};
if(dltMoney.selectedIndex==-1) {alert("请选择钱数!");return;};
var newRow=tbCondition.insertRow(0);
newRow.insertCell();
newRow.insertCell();
newRow.insertCell();
newRow.cells[0].innerText=dltLocation.value;
newRow.cells[1].innerText=dltEducation.value;
newRow.cells[2].innerText=dltMoney.value;
}
function Delete(){
var val = prompt("请输入要删除的行号","0");
if(val == "")
{
alert("请输入要删除的行号");
return;
}
var intVal = parseInt(val,10);
var oTable = document.all.tbCondition;
if(intVal >= oTable.rows.length)
{
alert("行号不能超过表格行数的最大值");
return;
}
oTable.rows[intVal+1].removeNode(true);
}
</script>
</head>
<body>
<table width="450" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="150"><select name="dltLocation" id="dltLocation" multiple size="6" style="width:100% ">
<option value="北京">北京</option>
<option value="广州">广州</option>
</select></td>
<td width="150"><select name="dltEducation" id="dltEducation" multiple size="6" style="width:100% ">
<option value="本科">本科</option>
<option value="专科">专科</option>
</select></td>
<td width="150"><select name="dltMoney" id="dltMoney" multiple size="6" style="width:100% ">
<option value="1000">1000</option>
<option value="2000">2000</option>
<option value="3000">3000</option>
</select></td>
</tr>
<tr>
<td colspan="3">
<table id="tbCondition" width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</td>
</tr>
</table>
<tr>
<td align="right"><input name="btnAdd" type="button" value="添加" onClick="Add()"></td>
<td> </td>
<td><input name="btnDelete" type="button" value="删除" onClick="Delete()"></td>
</tr>
</body>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Untitled Document</title>
<script language="javascript">
function Add(){
if(dltLocation.selectedIndex==-1) {alert("请选择地点!");return;};
if(dltEducation.selectedIndex==-1) {alert("请选择学历!");return;};
if(dltMoney.selectedIndex==-1) {alert("请选择钱数!");return;};
var newRow=tbCondition.insertRow(0);
newRow.insertCell();
newRow.insertCell();
newRow.insertCell();
newRow.cells[0].innerText=dltLocation.value;
newRow.cells[1].innerText=dltEducation.value;
newRow.cells[2].innerText=dltMoney.value;
}
function Delete(){
var val = prompt("请输入要删除的行号","0");
if(val == "")
{
alert("请输入要删除的行号");
return;
}
var intVal = parseInt(val,10);
var oTable = document.all.tbCondition;
if(intVal >= oTable.rows.length)
{
alert("行号不能超过表格行数的最大值");
return;
}
oTable.rows[intVal+1].removeNode(true);
}
</script>
</head>
<body>
<table width="450" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="150"><select name="dltLocation" id="dltLocation" multiple size="6" style="width:100% ">
<option value="北京">北京</option>
<option value="广州">广州</option>
</select></td>
<td width="150"><select name="dltEducation" id="dltEducation" multiple size="6" style="width:100% ">
<option value="本科">本科</option>
<option value="专科">专科</option>
</select></td>
<td width="150"><select name="dltMoney" id="dltMoney" multiple size="6" style="width:100% ">
<option value="1000">1000</option>
<option value="2000">2000</option>
<option value="3000">3000</option>
</select></td>
</tr>
<tr>
<td colspan="3">
<table id="tbCondition" width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</td>
</tr>
</table>
<tr>
<td align="right"><input name="btnAdd" type="button" value="添加" onClick="Add()"></td>
<td> </td>
<td><input name="btnDelete" type="button" value="删除" onClick="Delete()"></td>
</tr>
</body>
</html>
#1
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Untitled Document</title>
<script language="javascript">
function Add(){
if(dltLocation.selectedIndex==-1) {alert("请选择地点!");return;};
if(dltEducation.selectedIndex==-1) {alert("请选择学历!");return;};
if(dltMoney.selectedIndex==-1) {alert("请选择钱数!");return;};
var newRow=tbCondition.insertRow(0);
newRow.insertCell();
newRow.insertCell();
newRow.insertCell();
newRow.insertCell();
alert(dltLocation.value);
newRow.cells[0].innerText=dltLocation.value;
newRow.cells[1].innerText=dltEducation.value;
newRow.cells[2].innerText=dltMoney.value;
newRow.cells[3].innerHTML='<input type="button" value="删除" onclick="this.parentNode.parentNode.removeNode(true)">';
}
function Delete(){
//功能比较简单,自己写吧
}
</script>
</head>
<body>
<table width="450" border="1" cellspacing="0" cellpadding="0" ID="Table1">
<tr>
<td width="150"><select name="dltLocation" id="dltLocation" multiple size="6" style="width:100% ">
<option value="北京">北京</option>
<option value="广州">广州</option>
</select></td>
<td width="150"><select name="dltEducation" id="dltEducation" multiple size="6" style="width:100% ">
<option value="本科">本科</option>
<option value="专科">专科</option>
</select></td>
<td width="150"><select name="dltMoney" id="dltMoney" multiple size="6" style="width:100% ">
<option value="1000">1000</option>
<option value="2000">2000</option>
<option value="3000">3000</option>
</select></td>
</tr>
<tr>
<td align="right" colspan="3"><input name="btnAdd" type="button" value="添加" onClick="Add()" ID="Button1"></td>
</tr>
<tr>
<td colspan="3">
<table id="tbCondition" width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Untitled Document</title>
<script language="javascript">
function Add(){
if(dltLocation.selectedIndex==-1) {alert("请选择地点!");return;};
if(dltEducation.selectedIndex==-1) {alert("请选择学历!");return;};
if(dltMoney.selectedIndex==-1) {alert("请选择钱数!");return;};
var newRow=tbCondition.insertRow(0);
newRow.insertCell();
newRow.insertCell();
newRow.insertCell();
newRow.insertCell();
alert(dltLocation.value);
newRow.cells[0].innerText=dltLocation.value;
newRow.cells[1].innerText=dltEducation.value;
newRow.cells[2].innerText=dltMoney.value;
newRow.cells[3].innerHTML='<input type="button" value="删除" onclick="this.parentNode.parentNode.removeNode(true)">';
}
function Delete(){
//功能比较简单,自己写吧
}
</script>
</head>
<body>
<table width="450" border="1" cellspacing="0" cellpadding="0" ID="Table1">
<tr>
<td width="150"><select name="dltLocation" id="dltLocation" multiple size="6" style="width:100% ">
<option value="北京">北京</option>
<option value="广州">广州</option>
</select></td>
<td width="150"><select name="dltEducation" id="dltEducation" multiple size="6" style="width:100% ">
<option value="本科">本科</option>
<option value="专科">专科</option>
</select></td>
<td width="150"><select name="dltMoney" id="dltMoney" multiple size="6" style="width:100% ">
<option value="1000">1000</option>
<option value="2000">2000</option>
<option value="3000">3000</option>
</select></td>
</tr>
<tr>
<td align="right" colspan="3"><input name="btnAdd" type="button" value="添加" onClick="Add()" ID="Button1"></td>
</tr>
<tr>
<td colspan="3">
<table id="tbCondition" width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
#2
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Untitled Document</title>
<script language="javascript">
function Add(){
if(dltLocation.selectedIndex==-1) {alert("请选择地点!");return;};
if(dltEducation.selectedIndex==-1) {alert("请选择学历!");return;};
if(dltMoney.selectedIndex==-1) {alert("请选择钱数!");return;};
var newRow=tbCondition.insertRow(0);
newRow.insertCell();
newRow.insertCell();
newRow.insertCell();
newRow.cells[0].innerText=dltLocation.value;
newRow.cells[1].innerText=dltEducation.value;
newRow.cells[2].innerText=dltMoney.value;
}
function Delete(){
var val = prompt("请输入要删除的行号","0");
if(val == "")
{
alert("请输入要删除的行号");
return;
}
var intVal = parseInt(val,10);
var oTable = document.all.tbCondition;
if(intVal >= oTable.rows.length)
{
alert("行号不能超过表格行数的最大值");
return;
}
oTable.rows[intVal+1].removeNode(true);
}
</script>
</head>
<body>
<table width="450" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="150"><select name="dltLocation" id="dltLocation" multiple size="6" style="width:100% ">
<option value="北京">北京</option>
<option value="广州">广州</option>
</select></td>
<td width="150"><select name="dltEducation" id="dltEducation" multiple size="6" style="width:100% ">
<option value="本科">本科</option>
<option value="专科">专科</option>
</select></td>
<td width="150"><select name="dltMoney" id="dltMoney" multiple size="6" style="width:100% ">
<option value="1000">1000</option>
<option value="2000">2000</option>
<option value="3000">3000</option>
</select></td>
</tr>
<tr>
<td colspan="3">
<table id="tbCondition" width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</td>
</tr>
</table>
<tr>
<td align="right"><input name="btnAdd" type="button" value="添加" onClick="Add()"></td>
<td> </td>
<td><input name="btnDelete" type="button" value="删除" onClick="Delete()"></td>
</tr>
</body>
</html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Untitled Document</title>
<script language="javascript">
function Add(){
if(dltLocation.selectedIndex==-1) {alert("请选择地点!");return;};
if(dltEducation.selectedIndex==-1) {alert("请选择学历!");return;};
if(dltMoney.selectedIndex==-1) {alert("请选择钱数!");return;};
var newRow=tbCondition.insertRow(0);
newRow.insertCell();
newRow.insertCell();
newRow.insertCell();
newRow.cells[0].innerText=dltLocation.value;
newRow.cells[1].innerText=dltEducation.value;
newRow.cells[2].innerText=dltMoney.value;
}
function Delete(){
var val = prompt("请输入要删除的行号","0");
if(val == "")
{
alert("请输入要删除的行号");
return;
}
var intVal = parseInt(val,10);
var oTable = document.all.tbCondition;
if(intVal >= oTable.rows.length)
{
alert("行号不能超过表格行数的最大值");
return;
}
oTable.rows[intVal+1].removeNode(true);
}
</script>
</head>
<body>
<table width="450" border="1" cellspacing="0" cellpadding="0">
<tr>
<td width="150"><select name="dltLocation" id="dltLocation" multiple size="6" style="width:100% ">
<option value="北京">北京</option>
<option value="广州">广州</option>
</select></td>
<td width="150"><select name="dltEducation" id="dltEducation" multiple size="6" style="width:100% ">
<option value="本科">本科</option>
<option value="专科">专科</option>
</select></td>
<td width="150"><select name="dltMoney" id="dltMoney" multiple size="6" style="width:100% ">
<option value="1000">1000</option>
<option value="2000">2000</option>
<option value="3000">3000</option>
</select></td>
</tr>
<tr>
<td colspan="3">
<table id="tbCondition" width="100%" border="1" cellspacing="0" cellpadding="0">
<tr>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
</td>
</tr>
</table>
<tr>
<td align="right"><input name="btnAdd" type="button" value="添加" onClick="Add()"></td>
<td> </td>
<td><input name="btnDelete" type="button" value="删除" onClick="Delete()"></td>
</tr>
</body>
</html>