Bonjour à tous
en fait, je viens de m'en appercevoir j'aimerais faire un peu le même editeur Wysiwyg que celui du nouveau forum. Je me galere sur le CreateLink de la fonction execCommand.
J'ai l'image suivante :
<img src="editor/icones/link.gif" title="Lien" alt="Lien" onclick="setContent('CreateLink')" />
Qui appelle la fonction suivante :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
| function setContent(action){
if(IE){
ewin = window.frames['editeur'];
edoc = ewin.document;
}
if(MOZ){
ewin = document.getElementById('editeur').contentWindow;
edoc = document.getElementById('editeur').contentDocument;
}
if (action == 'CreateLink'){
var url
url=prompt('Lien hypertexte ', http:\\);
alert('Vous avez répondu : ' + url);
edoc.execCommand(action, false, url);
ewin.focus();
}
else {
edoc.execCommand(action, false, null);
ewin.focus();
}
} |
Mais j'ai le retour d'erreur suivant, que je ne comprend pas ...
Erreur : uncaught exception: [Exception... "Component returned failure code: 0x80004001 (NS_ERROR_NOT_IMPLEMENTED) [nsIDOMNSHTMLDocument.execCommand]" nsresult: "0x80004001 (NS_ERROR_NOT_IMPLEMENTED)" location: "JS frame :: http://capitol/sua-V2/MAJ/ActuAsso/AjouterActu.asp :: setContent :: line 37" data: no]
Merci,
jb
Partager