نسخ رمز رمز على النحو التالي:
وظيفة copyText () {
// نسخ المحتوى
var txt = document.getElementById ("table2").
// قم بإزالة المساحة
txt = txt.replace (// ، "") ؛
// إزالة البنك
txt = txt.replace (/<br> <br>/، "") ؛
if (window.clipboarddata) {
window.clipboarddata.cleardata () ؛
window.clipboarddata.setData ("text" ، txt) ؛
تنبيه ("تم نسخه بنجاح إلى لوحة التقطيع!") ؛
} آخر إذا (navigator.useragent.indexof ("Opera")! = -1) {
window.location = txt ؛
} آخر إذا (window.netscape) {
يحاول {
netscape.security.privilegemanager.EnablePrivilege ("UniversalxpConnect") ؛
} catch (e) {
ALERT ("" مرفوض بواسطة المستعرض!/n ، أدخل "حول: config" في شريط عنوان المتصفح واضغط على Enter/n ثم قم بتعيين "signed.applets.codebase_princport" إلى "true" ") ؛
}
var clip = components.classes ['@mozilla.org/widget/clipboard ؛ 1 '] .CreateInstance (components.Interfaces.nsiclipboard) ؛
إذا (! مقطع) العودة ؛
var trans = مكونات.
إذا (! trans) العودة ؛
trans.adddataflavor ('text/unicode') ؛
var str = new Object () ؛
var len = new Object () ؛
var str = components.classes ["@mozilla.org/support-string ؛ 1"] .CreateinStance (components.Interfaces.nsisupportsString) ؛
var copyText = txt ؛
str.data = copyText ؛
trans.setTransferData ("text/unicode" ، str ، copytext.length * 2) ؛
var clipid = components.Interfaces.nsiclipboard ؛
إذا (! مقطع) العودة كاذبة ؛
clip.setData (trans ، null ، clipid.kglobalclipboard) ؛
تنبيه ("تم نسخه بنجاح إلى لوحة التقطيع!") ؛
}
}