1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| (...)
<td align="center">
<!-- The text field -->
<input hidden="hidden" type="text" value="<?php echo $file5; ?>" id="myInput">
<!-- The button used to copy the text -->
<button onclick="myFunction()" onmouseout="outFunc()">Copier URL</button>
</td>
(...)
<?php } // fin de boucle ?>
(...)
<script>
function myFunction() {
var copyText = document.getElementById("myInput");
copyText.select();
copyText.setSelectionRange(0, 99999);
document.execCommand("copy");
var tooltip = document.getElementById("myTooltip");
tooltip.innerHTML = "Copied: " + copyText.value;
}
function outFunc() {
var tooltip = document.getElementById("myTooltip");
tooltip.innerHTML = "Copy to clipboard";
}
</script>
(...) |
Partager