Hi guys,
I am trying to add a Copy to Clipboard function, so that when viewing a record and clicking a button, it copies the answer to the clipboard. Here are the changed that I have made. Please tell me if I am doing anything wrong:
##########################################################
Templates/artikel.tpl
##########################################################
--------ADDED------------
<img src="images/copy.gif" alt="{writeCopyToClipboard}" title="{writeCopyToClipboard}" width="16" height="16" border="0" /> {writeCopyClipboard}
--------ADDED-----------
+
---------ADDED----------
<!-- Article -->
<SPAN ID="copytext"> <p>{writeContent}</p> </SPAN>
<!-- /Article -->
<TEXTAREA ID="holdtext" STYLE="display:none;">
</TEXTAREA>
---------ADDED----------
##########################################################
artikel.php
##########################################################
------ADDED-------------
$copyClipboard = sprintf(
'<SCRIPT LANGUAGE="JavaScript">function ClipBoard()
{
holdtext.innerText = copytext.innerText;
Copied = holdtext.createTextRange();
Copied.execCommand("RemoveFormat");
Copied.execCommand("Copy");
}
</SCRIPT>
<a href="#" onclick:"ClipBoard();">%s</a>',
$PMF_LANG['msgCopyToClipboard']);
----ADDED----------------
+
-------ADDED-------------
"writeCopyToClipboard" => $PMF_LANG["msgCopyToClipboard"],
"writeCopyClipboard" => $copyClipboard,
--------ADDED-----------
##########################################################
copy.gif to Images/
##########################################################
lang/language_en
##########################################################
-------ADDED------------
$PMF_LANG["msgCopyToClipboard"] = "Copy to Clipboard";
-------ADDED-----------
##########################################################
Copy to Clipboard
Moderator: Thorsten
Hi Sergey,
when you view the printed out HTML from your browser, do you see any error?
PS: if you email me a zipped file with both artikel.php and artikel.tpl I can test it too.
when you view the printed out HTML from your browser, do you see any error?
PS: if you email me a zipped file with both artikel.php and artikel.tpl I can test it too.
phpMyFAQ QA / Developer
Amazon.co.uk Wishlist
Amazon.co.uk Wishlist
-
sergey.khodjamirian
- Posts: 35
- Joined: Wed Aug 09, 2006 11:36 am
Hi Sergey,
I look at it within few hours: in the mean time I've seen that the JS code seem to be quite right 'cause it is equal to that found on http://www.htmlgoodies.com/beyond/javas ... hp/3458851, where it works.
I'll reply both to you by email with the working code and here with some info for Community convenience.
Regards,
Matteo
I look at it within few hours: in the mean time I've seen that the JS code seem to be quite right 'cause it is equal to that found on http://www.htmlgoodies.com/beyond/javas ... hp/3458851, where it works.
I'll reply both to you by email with the working code and here with some info for Community convenience.
Regards,
Matteo
phpMyFAQ QA / Developer
Amazon.co.uk Wishlist
Amazon.co.uk Wishlist
-
fabio.sampo
- Posts: 1
- Joined: Mon Nov 18, 2013 9:20 am
Re: Copy to Clipboard
hello everyone, I'm new to the forum. I tried to put this code, but I do not work. Can anyone help me? thanks to all