开发者

How to select a word from paragraph in a single right click?

Hi Techies@StackOverFlow, i am researching on a logic, by which i can select a text in a single right mouse click. What I want to say is that , I want to implement, the double click text selection, b开发者_如何学JAVAut in a other way that is in single click and right click.

For example if you double click on the text displaying anywhere on this web, the text will get selected. Similar thing i want to implement. I prefer Javascript as i am implementing it on web.

Please help me

Amit


Do one thing write event handler for right click and inside it call your double click function which should select the text.

I haven't tested it but this might work.


It should be fairly simple. Just detect whether or not it is a right click via the onclick method and the event code (2 in this case) in Javascript - if it is, then do the necessary code to select the text (it varies from the IE family to the rest of the real browsers). Should be all you need to do.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜