copy to clipboard with left click
Possible Duplicate:
How to copy to the clipboard in JavaScript?
Suppose I have a webpage with this content:
<h1 id="foo"> Some string </h1>
Now I want to to copy Some string
to clipboard. But the conditions are:
The only way is to hover over the <h1>
with id="foo"
and press left mouse button.
I googled it and found a JavaScript way to do this. But soon I knew that that's not cross browser. So, is there is way to copy text on left click of the hovered h1
.
Using an adobe flash call is probably your best bet.
I have used this one with marginal success: http://code.google.com/p/zeroclipboard/
If the java method is not acceptable because it is not cross browser compatible I am not even going to suggest some decrepit (and probably security hole causing) Active X component which would effectively be IE only (with few exceptions).
Started the search here and found http://www.steamdev.com/zclip
This plugin is cross-compatible with all browsers and works well: http://plugins.jquery.com/project/clipboard
链接地址: http://www.djcxy.com/p/19738.html上一篇: 选择并复制文本到剪贴板双击jQuery
下一篇: 用鼠标左键复制到剪贴板