- Szemérmes szerzet a Gigabyte lefrissebb csúcs-VGA-ja
- Egységesebb USB-s képességeket szeretne a notebookokon a Microsoft
- 3320 MHz-ig skálázódnak az XFX Radeon RX 9060 XT kártyái
- Elegáns és igen kompakt NVIDIA Blackwell VGA-t villantott az MSI
- Szinte megfizethetetlenül magas lesz a TSMC A14-es node-jának ára
- AMD vs. INTEL vs. NVIDIA
- Házimozi belépő szinten
- Csütörtökön jön a Redmi Pad 2
- Intel Core i5 / i7 / i9 "Alder Lake-Raptor Lake/Refresh" (LGA1700)
- Milyen billentyűzetet vegyek?
- Mini-ITX
- Jön az új 80 Plus fokozat az adatközpontokhoz
- Milyen házat vegyek?
- Intel Core i3 / i5 / i7 / i9 10xxx "Comet Lake" és i3 / i5 / i7 / i9 11xxx "Rocket Lake" (LGA1200)
- Mini PC
-
PROHARDVER!
JavaScript != Java (A JavaScript nem összekeverendő a Javával, két különböző programozási nyelvről van szó!)
Új hozzászólás Aktív témák
-
btz
addikt
Ezt próbálgattam már. Nálam nem működik (szokás szerint)
Először így próbáltam:
<script type="text/javascript" >
// Create a fake textarea
const textAreaEle = document.createElement('textarea');
// Reset styles
textAreaEle.style.border = '0';
textAreaEle.style.padding = '0';
textAreaEle.style.margin = '0';
// Set the absolute position
// User won't see the element
textAreaEle.style.position = 'absolute';
textAreaEle.style.left = '-9999px';
textAreaEle.style.top = `0px`;
// Set the value
textAreaEle.value = text;
// Append the textarea to body
document.body.appendChild(textAreaEle);
// Focus and select the text
textAreaEle.focus();
textAreaEle.select();
// Execute the "copy" command
try {
document.execCommand('copy');
} catch (err) {
// Unable to copy
} finally {
// Remove the textarea
document.body.removeChild(textAreaEle);
}
</script>Ekkor a textAreaEle.value = text; érték nem volt definiálva így készítettem neki egy változót. var text = "tesztszöveg";
<script type="text/javascript" >
// Create a fake textarea
const textAreaEle = document.createElement('textarea');
// Reset styles
textAreaEle.style.border = '0';
textAreaEle.style.padding = '0';
textAreaEle.style.margin = '0';
// Set the absolute position
// User won't see the element
textAreaEle.style.position = 'absolute';
textAreaEle.style.left = '-9999px';
textAreaEle.style.top = `0px`;
var text = "tesztszöveg";
// Set the value
textAreaEle.value = text;
// Append the textarea to body
document.body.appendChild(textAreaEle);
// Focus and select the text
textAreaEle.focus();
textAreaEle.select();
// Execute the "copy" command
try {
document.execCommand('copy');
} catch (err) {
// Unable to copy
} finally {
// Remove the textarea
document.body.removeChild(textAreaEle);
}
</script>Hiba: Uncaught TypeError: Cannot read property 'appendChild' of null.
Beraktam bodyba a scriptet, utána semmit nem csinált, viszont a hiba megszűnt.
Aztán a document.body részt cseréltem document.getElementById("mainContent").appendChild(textAreaEle);-re. Így már megjelenik a textarea, benne a tesztszöveg felirattal. (A kódból kitöröltem azt a részt ami elrejti a textarea-t).<html>
<body>
<div id="mainContent">
MAIN CONTENT<br />
</div>
<script type="text/javascript" >
// Create a fake textarea
const textAreaEle = document.createElement('textarea');
var text = "tesztszöveg";
// Set the value
textAreaEle.value = text;
// Append the textarea to body
document.getElementById("mainContent").appendChild(textAreaEle);
// Focus and select the text
textAreaEle.focus();
textAreaEle.select();
// Execute the "copy" command
try {
document.execCommand('copy');
} catch (err) {
// Unable to copy
} finally {
// Remove the textarea
//document.body.removeChild(textAreaEle);
}
</script>
</body>
<html>Viszont nem másol semmit a vágólapra.
Új hozzászólás Aktív témák
- AMD vs. INTEL vs. NVIDIA
- 2025 - A nyár összes videojátékos eseménye
- Nintendo Switch 2
- Samsung Galaxy S23 és S23+ - ami belül van, az számít igazán
- Házimozi belépő szinten
- Csütörtökön jön a Redmi Pad 2
- Intel Core i5 / i7 / i9 "Alder Lake-Raptor Lake/Refresh" (LGA1700)
- Napelem
- iPhone topik
- Megdöbbentő bejelentés a Nothingtól
- További aktív témák...
- Keresek ROG Ally X-et.
- Új Lenovo Yoga Pro 7 Profi Ultrabook -40% Ryzen 7 7735HS 8Mag 16/512 2,5K RadeonT 680M 2GB
- Eladó használt XIAOMI Vacuum MOP Pro robotporszívó!
- Bomba ár! Dell Precision M4700 i7 Extreme 3940XM I 24GB I 256SSD I 15,6" FHD I K2000M I W10 I Gari!
- Bomba ár! Dell Latitude E6540 - i5-4GEN I 8GB I 320GB I DVDRW I 15,6" FHD I HDMI I W10 I Gari
- LG 65BX - 65" OLED - 4K 120Hz 1ms - NVIDIA G-Sync - FreeSync Premium - HDMI 2.1 - PS5 és Xbox Ready!
- Újszerű Apple Macbook Air 15,3" M3 8C CPU/10C GPU/16GB/256GB - (MC9G4MG/A) Éjfekete - 1 év garancia
- ÁRGARANCIA!Épített KomPhone i5 13400F 16/32/64GB RAM RTX 5070 12GB GAMER PC termékbeszámítással
- HP ProBook 430 G4 Pentium 4415U (bios jelszavas)
- AKCIÓ! Lenovo Thinkpad T14 Gen 3 üzleti notebook - i5 1245U 16GB RAM 512GB SSD Intel Iris XeW11
Állásajánlatok
Cég: Liszt Ferenc Zeneművészeti Egyetem
Város: Budapest
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest