English 中文(简体)
IE8 右边点上选用的文字
原标题:Text deselected on right click in IE8

我想从我的网页上的一个文本区挑选用户。 我有一个环境菜单,用户可以在正确筛选时使用。 这是我从IE8的文稿中检索部分内容的代码。

var textComponent = document.getElementById( myTextArea );
var selectedText;
// IE version
if (document.selection != undefined)
{
textComponent.focus();
selectedText= document.selection.createRange();
alert(sel.text);
}

Now I notice that before allowing the blocked content (i.e. the Javascript) I can select a text in the text area and on right click it does not get deselected. But, when I allow the script, on right clicking the text that I selected gets deselected. Which is why I cannot retrieve the content.

我搜索了这个网站,但找不到任何解决办法。 谁能告诉我问题是什么?

最佳回答

将X箱的重心方法或使用网页上任何内容的(重点)方法,将明确案文选择。

在这里寻求一个巨大的答案:

在重点修改时保留案文选择

问题回答

暂无回答




相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签