//A.html;
<form>
<table border='1' name='tab' id='tab' width='90%' align='center' ondblclick='_sel()'>
  <tr>
    <td>1</td>
    <td>2</td>
  </tr>
  <tr>
    <td>1</td>
    <td>2</td>
  </tr> 
</table>
<script>
function _sel()
{
  if (window.event.srcElement.tagName!="TD") return false;
  var obj=window.event.srcElement;
  var rt=window.showModalDialog("B.html","","");
  if (rt!="") obj.innerHTML=rt;
  return true;
}
</script>
</form>
//B.html
<script>
function set(isYes)
{
  var index=document.all.set.selectedIndex;
  if (isYes) window.returnValue=document.all.set.options[index].value;
  else window.returnValue="";
  window.close();
  return true;
}
</script>
<select id='set'>
  <option value='11'>11</option>
  <option value='22'>22</option>
</select>
<input type='button' value='yes' onclick='set(true);'>
<input type='button' value='cancel' onclick='set(false)'>

解决方案 »

  1.   

    实在是太感谢了,万分的感谢!!
    现在你这个是弹出新页面,能否在只一个页面上做~~可是直接编辑一个select框的吗???用runtimeStyle去构造一个select框,可以吗???谢谢
      

  2.   

    <table id='tab' width='80%' align='center' border='1' ondblclick='_change()'>
      <tr>
        <td>1</td>
        <td>2</td>
      </tr>
      <tr>
        <td>3</td>
        <td>4</td>
      </tr>
    </table><script>
    var oldHTML="";
    function _change()
    {
      var obj=window.event.srcElement;
      if (!obj||obj.tagName!="TD") return false;
      oldHTML=obj.innerHTML;
      var content="<select id=set><option value=11>11</option><option value=22>22</option></select>";
      content+="<input type=button id=ok value='yes' onclick='_getChange(true);'>";
      content+="<input type=button id=cancel value='cancel' onclick='_getChange(false);'>";
      obj.innerHTML=content;
      obj.width="50%";
      return true;
    }
    function _getChange(isOk)
    {
      var obj=window.event.srcElement;
      if (!obj||!document.all.set) return false;
      obj=obj.parentNode;
      if (isOk)
      {
        var select=document.all.set;
        var index=select.selectedIndex;
        var value=select.options[index].value;
        obj.width="50%";
        obj.innerHTML=value;
        return true;
      }
      else
      {
        obj.innerHTML=oldHTML;
        obj.width="50%";
        return true;
      }
    }
    </script>>>可编辑的select框你查一下资料把。