Un code pour copier le contenu d'un textarea avec un simple click

Contenu du snippet

Tout les commentaires sont dans le code

Source / Exemple :


<HTML>
<HEAD>
<TITLE>moveToPoint Example</TITLE>
<meta name="generator" content="Namo WebEditor v4.0">
</HEAD>
<BODY>
<p align="center">
<textarea  id="texte" readonly rows="15" cols="45">Votre code ou texte  très long ici Votre code ou texte  très long ici Votre code ou texte  très long ici Votre code ou texte  très long ici Votre code ou texte  très long ici Votre code ou texte  très long ici Votre code ou texte  très long ici Votre code ou texte  très long ici Votre code ou texte  très long ici Votre code ou texte  très long ici Votre code ou texte  très long ici Votre code ou texte  très long ici Votre code ou texte  très long ici Votre code ou texte  très long ici Votre code ou texte  très long ici Votre code ou texte  très long ici vvvvVotre code ou texte  très long ici Votre code ou texte  très long ici Votre code ou texte  très long ici Votre code ou texte  très long ici Votre code ou texte  très long ici </textarea>
<p align="center">
<button  OnClick="bouger()">
Copier le code dans le Presse-papier</p>  
<p align="center">En anglais: copy into clipboard </button></p>
<p align="center"><font face="Verdana"><span style="font-size:9pt;"><b>Ctrl </b>+ <b>V </b>pour 
<b>coller</b></span></font></p>
<SCRIPT LANGUAGE="VBScript">
<!--
Sub bouger()
set selectionner=document.all("texte").createTextRange()
selectionner.select()
selectionner.execCommand "Copy" 
End sub
-->
</SCRIPT>
</BODY>
</HTML>

Conclusion :


sidoummoudz@yahoo.fr

A voir également

Vous n'êtes pas encore membre ?

inscrivez-vous, c'est gratuit et ça prend moins d'une minute !

Les membres obtiennent plus de réponses que les utilisateurs anonymes.

Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.

Le fait d'être membre vous permet d'avoir des options supplémentaires.