Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Converting/Creating Blocks
Author Message
hicuxunicorniobestbuildpc
The Mouse Is Extension Of Arm



Joined: Aug 13, 2009
Posts: 1084

PostPosted: Mon Nov 11, 2013 4:39 am Reply with quote

Guys. I am trying to make a better simple block(Link to us) but unfortunately my clipboard function is not working properly. I wonder what is the best solution on this case.

my block

Code:
<?php



if (!defined('BLOCK_FILE')) {Header('Location: ../index.php');  die();}
if (!defined('PHP_EOL')) define('PHP_EOL', strtoupper(substr(PHP_OS,0,3) == 'WIN') ? "\r\n" : "\n");


$content.='<div align="center">' . PHP_EOL;

/* replace with your link and banner image */

$content .= '<a href="http://www.bestbuildpc.org/" target="_blank"><img border="0" src="http://www.bestbuildpc.org/images/link.gif" width="88" height="33" alt="title" /></a><br />' . PHP_EOL;
$content .= '<div class="text-center">Link Us</div><br />' . PHP_EOL;
$content .= '<textarea id="holdtext" rows="1" cols="11">&lt;a href="http://www.bestbuildpc.org/" target="_blank"&gt;&lt;img border="0" src="http://www.bestbuildpc.org/images/link.gif" width="88" height="33" alt="title"&gt;&lt;/a&gt;&lt;br /&gt;</textarea><br />' . PHP_EOL;

$content .= '<input onclick=ClipBoard(); type=button value="copy code" />' . PHP_EOL;
$content.='</div>' . PHP_EOL;

addJSToBody('js/copy.js', 'file');


Sad

copy.js
Code:
 function ClipBoard() 

 {      
 Copied = holdtext.createTextRange();
   Copied.execCommand("RemoveFormat");
   Copied.execCommand("Copy");
   alert("This code has been copied to your clipboard.\nYou can now paste the script in your affiliates.");
 }


What am I doing wrong when I click on copy it doesn't work.

I found this one which works with almost all browser.
[ Only registered users can see links on this board! Get registered or login! ]
 
View user's profile Send private message
spasticdonkey
RavenNuke(tm) Development Team



Joined: Dec 02, 2006
Posts: 1693
Location: Texas, USA

PostPosted: Mon Nov 11, 2013 7:39 am Reply with quote

"copy to clipboard" is difficult to get working in all browsers due to different ways textareas are handled by different browsers; as well as security concerns. The most reliable methods used a combination of jquery and flash but I have read they no longer work with flash 10.

There may be some suggestions on stackoverflow...
 
View user's profile Send private message Visit poster's website
hicuxunicorniobestbuildpc







PostPosted: Mon Nov 11, 2013 8:18 am Reply with quote

so what is the best solution for that? Why a simple javascript doesn't work at all?
 
neralex
Site Admin



Joined: Aug 22, 2007
Posts: 1711

PostPosted: Mon Nov 11, 2013 8:30 am Reply with quote

[ Only registered users can see links on this board! Get registered or login! ] [ Only registered users can see links on this board! Get registered or login! ] [ Only registered users can see links on this board! Get registered or login! ]

_________________
Github: RavenNuke 
View user's profile Send private message
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> Converting/Creating Blocks

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©