• 18-10-2020, 00:14:23
    #1
    Üyeliği durduruldu
    Arkadaşlar merhaba, HTML bir sitede bulunan "Panoya Kopyala" butonuna basıldığında istediğimiz içeriğin panoya kopyalanmasını istiyoruz. Yani butonun linkini kopyalama olarak ayarlamak istiyoruz. Bunun için ne yapmak gerekir?
  • 18-10-2020, 00:15:57
    #2
    <input type="text" value="Hello World" id="kopyala">
    <button onclick="myFunction()">Copy text</button>
    
    
    <script>
    function myFunction() {
    var copyText = document.getElementById("kopyala");
    copyText.select();
    copyText.setSelectionRange(0, 99999)
    document.execCommand("copy");
    }
    </script>
  • 18-10-2020, 00:16:48
    #3
    
    <button onclick="myFunction()">Copy text</button>
    
    function myFunction() {
    /* Get the text field */
    var copyText = document.getElementById("myInput");
    
    /* Select the text field */
    copyText.select();
    copyText.setSelectionRange(0, 99999); /*For mobile devices*/
    
    /* Copy the text inside the text field */
    document.execCommand("copy");
    
    /* Alert the copied text */
    alert("Copied the text: " + copyText.value);
    }
    Dipnot : Html ve JavaScript bilmiyorum. Google Biliyorum