2012-06-04 147 views
0

i'm trying to produce a button or <a> link that will act like a or it will ctrl+c the given <a> on the specified <li>. Like the "Copy" button on url shorteners like bit.ly. I just have no idea if this is done in jquery? Anyone have a copy of the code? Thanks a lot.鏈接將複製<a href> tag

+2

想要單擊一個按鈕或鏈接以將* what * text複製到* what * element?展示您的HTML,向我們展示您的JavaScript(嘗試很多):show us [*您嘗試過的*](http://whathaveyoutried.com/)。 –

+0

@DavidThomas我認爲他想將文本複製到剪貼板中,而不是其他元素。 – Andy

+1

我還沒有爲該功能做任何JavaScript,因爲我不知道它是否真的在JavaScript中完成。但是,這個想法就像http://bit.ly。 – jmc

回答

0

You need flash to copy something to the clipboard, because js is restricted for that matter (for security reasons). As you can see, bit.ly uses the same technique.

IE is the only browser, which is capable of pasting to the clipboard with javascript.

jQuery-Plugin, that uses the flash-fallback: http://www.steamdev.com/zclip/