开发者

How can I keep the focus to my selected text when I click a button?

开发者 https://www.devze.com 2023-01-31 06:23 出处:网络
I have a text selection for my 开发者_Python百科editor in IE written in javascript. checkedText = parent.frames[\'myframe\'].document.selection.createRange();

I have a text selection for my 开发者_Python百科editor in IE written in javascript.

checkedText = parent.frames['myframe'].document.selection.createRange();

Everything works ok just the first time. Then if I click a button the focus is gone for a while and the checkedText has the previous text as well. I tried also keep the focus with:

checkedText.select();

but it doesn't work. I know it is a but hard to explain my problem but if anyone has an idea I would appreciate it.

thanks a lot


Does the following not work? If not, maybe you can post a page showing the problem.

parent.frames['myframe'].focus();
checkedText.select();


document.getElementById("test").select();
document.getElementById("test").focus();
0

精彩评论

暂无评论...
验证码 换一张
取 消