Sujet : Re: Interagir avec le presse-papiers dans une page web
De : loiseauthierry (at) *nospam* free.fr (Thierry Loiseau)
Groupes : fr.comp.lang.javascriptDate : 24. Sep 2024, 09:24:16
Autres entêtes
Organisation : La tête dans les étoiles
Message-ID : <66f27730$0$3595$426a74cc@news.free.fr>
References : 1 2 3
User-Agent : MacSOUP/F-2.8.4 (6da4d6e6d0) (Mac OS X version 10.9.5 (x86))
Olivier Miakinen <om+
news@miakinen.net> wrote:
Mettre tout d'abord dans le <head>
<script>
function c(v) {navigator.clipboard.writeText(v);}
</script>
Ok.
function w(c) {navigator.clipboard.writeText(c);}
fonctionne aussi :)
Pour exemple sur les trois premiers éléments :
<tr><td >opérations</td><td>+ - ±</td></tr>
faire exemple 1 :
<tr><td >opérations</td><td>
<span onclick="c(this.innerText)">+</span>
<span onclick="c(this.innerText)">-</span>
<span onclick="c(this.innerText)">±</span>
</td></tr>
Méthode plus systématique.
Surtout intéressant si plus qu'un caractère, si il y a des mots voire
une phrase :)
faire exemple 2 :
<tr><td >opérations</td><td>
<span onclick="c('+')">+</span>
<span onclick="c('-')">-</span>
<span onclick="c('±')">±</span>
</td></tr>
Et méthode à la fois plus légère et plus lisible. Je pense que je vais
choisir ça.
Excellent choix, dis le serveur...
C'est un peu lourd mais ça fonctionne... je crois :)
Je vais le tester. Tu penses donc qu'il n'y a pas besoin de https ni de
manifest.json ?
Il parait que ça marcherait même en local, alors soyons fous, des
copier-coller de <span onclick="c('')" title=""></span> comme par
exemple
<span onclick="c('+')" title="plus">+</span>
<span onclick="c('+')" title="moins">+</span>
<span onclick="c('±')" title="plus ou moins">±</span>
...
;-)
-- * * __*__ * * * * -----oOOo--- O ---oOOo------- * * http://astrophoto.free.fr * * * -------- oOOo oOOo ---------- *