我正在为html wysiwyg编辑器编写代码。我正在尝试修改编辑器中已经存在的表。我有一个菜单,可以从中修改表中的行/列。
插入新行/列后,需要将焦点设置为新行/列。这个很好用。
但是,当我删除一行/列时,我无法将焦点设置到附近的行/列。
我将tabIndex属性设置为td来聚焦它。
tbody.removeChild(tr); //tr is the row to be deleted
pre_tr.childNodes[td.cellIndex].tabIndex = 1; //pre_tr has the previous tr to be focused
pre_tr.childNodes[td.cellIndex].focus();在这方面的任何帮助都将受到赞赏。谢谢。
发布于 2012-03-01 10:26:56
<div style="height:900px; background-color:gray;"> DIV A </div>
<br />
<div style="height:300px; background-color:#ECECEC;"> DIV B <input style="border:0px; background-color:#ECECEC;" readonly="true" type="text" id="b"/> </div>
<script>
document.getElementById('b').focus();
</script>希望能成功..。我不知道这是正确的方法。
什么都没有好处.
https://stackoverflow.com/questions/9513779
复制相似问题