Javascript中奇怪的下拉菜单问题

3

我需要翻译一个关于下拉菜单的奇怪问题。

我有一个

company.prototype.buildTable=function(){
  var thisObj=this;

  tableTD = createElement('td');
  tableTD.onclick=function(){thisObj.edit(this);}
  this.table.appendChild(tableTD);  //append td to the table

  // more td

}

company.prototype.edit = function(thisRow) {
  $thisRow=$(thisRow);
  var menu=document.createElement('select');
      menu.className='menu';

   //employees is an array containing employee info

   for(var i=0; i<employees.length; i++){

           var option=document.createElement('option');
               option.className='option';
               option.innerHTML=employees[i].name;
               option.value=employees[i].email;

            menu.appendChild(option);
         }

   $thisRow.append(selectMenu);
}

我可以看到一个下拉菜单在我的td中。然而,当我点击菜单时,我必须按住鼠标来保持选项菜单打开,否则选项菜单将关闭。即使我按住鼠标并选择一个选项,下拉菜单的值也不会改变(它仍然显示在选择菜单中的第一个选项)。我希望我能够清楚地解释我的问题。
有人可以帮我解决这个奇怪的问题吗?

问题出在追加 OPTION(它们是否成功追加?)还是使用 SELECT 上? - feeela
1个回答

0

你有这个事实的任何来源吗? - feeela

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接