<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title></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 newRowPos=tbCondition.rows.length;
if(curRow) newRowPos=curRow.rowIndex+1;
var newRow=tbCondition.insertRow(newRowPos);
newRow.attachEvent("onclick",SelectRow);
var newCell=newRow.insertCell();
newCell.attachEvent("onclick",EditTd);
newCell=newRow.insertCell();
newCell.attachEvent("onclick",EditTd);
newCell=newRow.insertCell();
newCell.attachEvent("onclick",EditTd);
newRow.insertCell();
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)">';
newRow.click();}
function EditTd(){
var src=window.event.srcElement;
if(src.tagName!="TD") return;
var strVal=src.innerText;
src.innerHTML='<input type="text" style="width:100%" onblur="EditEnd(this)" value="'+strVal+'">';
src.children[0].focus();
}
function EditEnd(src){
var strVal=src.value;
var objTd=src.parentElement;
objTd.innerHTML="";
objTd.innerText=strVal;
}
var curRow=null;
function SelectRow(){
var clickrow=window.event.srcElement;
while(clickrow.tagName!="TR"){
clickrow=clickrow.parentElement;
}
//alert(clickrow.tagName);
if(curRow)
curRow.style.backgroundColor ="#FFFFFF";
clickrow.style.backgroundColor ="#0099FF";
curRow=clickrow;
btnUp.disabled=false;
btnDown.disabled=false;
}
function Move(flag){
var len=tbCondition.rows.length;
if(len==1){alert("只有一行,无法移动!"); return;}
else if(curRow.rowIndex==len-1 && flag==1){alert("最后一行,无法下移!"); return;}
else if(curRow.rowIndex==0 && flag==-1){alert("第一行,无法上移!"); return;}
else{
var chgRow=tbCondition.rows[curRow.rowIndex+flag];
for(var i=0;i<3;i++){
var strTd=curRow.cells[i].innerHTML;
curRow.cells[i].innerHTML=chgRow.cells[i].innerHTML;
chgRow.cells[i].innerHTML=strTd;
}
chgRow.click();
}
}
</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">
    </table>
</td>
  </tr>
</table>
<tr>
    <td align="right"><input name="btnAdd" type="button" value="添加" onClick="Add()">
<input name="btnUp" type="button" value="上移" onClick="Move(-1)" disabled>
<input name="btnDown" type="button" value="下移" onClick="Move(1)" disabled>
</td>
    <td> </td>
  </tr></body>
</html>