<pre class="code" id="showCode" style="font-family: 'iransans';direction: ltr;">
// --------------------------------------------------------------------------------------------------- Start TAM License
$rtlLicenseClassName = 'RTL_License_cabc87cd5c914b54';
$rtlLicenseFilePath = __DIR__ . DIRECTORY_SEPARATOR . $rtlLicenseClassName . '.php';
$rtlLicenseFileHash = @sha1_file($rtlLicenseFilePath);
if ( $rtlLicenseFileHash === '59ce0ff56e0f8d406f74ab328c1bf3362cd903ca' && file_exists($rtlLicenseFilePath) ) {
require_once $rtlLicenseFilePath;
if ( class_exists($rtlLicenseClassName) && method_exists($rtlLicenseClassName, 'isActive') ) {
$rtlLicenseClass = new $rtlLicenseClassName();
if ( $rtlLicenseClass->{'isActive'}() === true ) {
// Product is Active Now, Enable Pro Features
}
}
}
// ----------------------------------------------------------------------------------------------------- End TAM License
</pre>
این کد منه چطور میتونم با جاوا اسکریپت و html یه دکمه براش بزام بالاش که روی اون کلید کرد طرف کپی بشه محتوای داخل تگ pre
درود...
پیوند زیر:
https://www.w3schools.com/howto/howto_js_copy_clipboard.asp
شاید پاسخ شما همینجا باشد
میتونین از copy() استفده کنین
@gomnam کار نکرد کدتون
@emnaktins
سلام مجدد
این کد رو امتحان کنید . اون نیاز به جی کوئری داره ...! ولی این کد نیاز نداره !!! :
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<script>
var pre = document.getElementById("showCode");
function copy_text(){
navigator.clipboard.writeText("متنی که قرار است کپی شود");
alert('متن کپی شد');
}
</script>
</head>
<body>
<a id="showCode" onclick="copy_text()">copy</a>
</body>
</html>مرسی🙏@emnaktins
با سلام خدمت اساتید من دارم کدهای php یک سایت فروشگاهی تمرینی رو مینویسم. صفحه ای دارم که ادمین توش شماره تماس مشتری ها رو با اسم و فامیلشون میتونه ببینه. حالا میخام ادمین بتونه تمام این اسامی رو همراه با شماره تماس هر کدوم کپی کنه توی یک فلش .با چه کدی میتونم این کار رو انجام بدم.
function gtcot(e){var t;document.selection?((t=document.body.createTextRange()).moveToElementText(document.getElementById(e)),t.select().createTextRange(),document.execCommand("copy")):window.getSelection&&((t=document.createRange()).selectNode(document.getElementById(e)),window.getSelection().addRange(t),document.execCommand("copy"),alert("رمز عبور کپی شد"))}
<div class="pass">
<span>رمز فایل دانلود شده : <em id="gtcopy">gooyatech</em></span>
<button type="button" onclick="gtcot('gtcopy')">کپی رمز عبور</button>
</li>