Bonjour,

J'ai lu le post suivant
http://www.developpez.net/forums/d34...presse-papier/

Mais j'essaie en vain de copier du texte dans le presse papier à partir du code javascript, j'utilise le script suivant :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<html>
<head>
<SCRIPT LANGUAGE="JavaScript">
function ClipBoard() 
{
 holdtext.innerText = copytext.innerText;
 Copied = holdtext.createTextRange();
 Copied.execCommand("Copy");
 }
</SCRIPT> 
</head>
<body>
 
<SPAN ID="copytext" STYLE="height:150;width:162;background-color:pink">
This text will be copied onto the clipboard when you click the button below. Try it!
</SPAN> 
<TEXTAREA ID="holdtext" STYLE="display:none;">
</TEXTAREA>
 <BUTTON onClick="ClipBoard();">Copy to Clipboard</BUTTON>
 
</body>
</html>

Et j'obtiens le résultat suivant :
Sous Firefox 18.0.2 : Ne fonctionne pas
Sous IE 9 : Copie l'adresse absolue du fichier html dans le presse papier
Sous Google Chrome : Ne fonctionne pas

Que dois-je corriger dans le script précédent pour que ça fonctionne ?

Merci d'avance pour votre aide,
Carole