Non, parce qu'en fait cette image est ajoutée par la fonction execCommand dans une iframe éditable, et donc il est impossible de lui attribuer un attribut onClick, et, de toute façon, onClick ne fonctionne pas dans une iframe éditable (sous Firefox)
Le HTML =>
le bouton qui permet d'insérer l'image :
1 2 3 4
| <input type="button" value="Image" onclick="inserImage()" />
<iframe designMode="On">
</iframe> |
La fonction qui insère l'image :
1 2 3 4 5 6 7 8
| function inserImage () {
if (retourneIframe()) idFrame=retourneIframe (); else return;
var cmd1="InsertImage";
var cmd2=false;
var cmd3="http://monImage.gif";
if (InternetExplorer()) window.frames[idFrame].document.execCommand(cmd1,cmd2,cmd3);
else document.getElementById(idFrame).contentDocument.execCommand(cmd1,cmd2,cmd3); return;
} |
Le bouton pour récupérer l'objet image qui vient d'etre ajouté dans l'iframe via execCommand :
<input type="button" value="Get image ajoutée" onclick="getImage();" />
et sa fonction dont je cherche l'équivalent pour FF
1 2 3 4 5
|
function getImage () {
var node=window.frames[IDFRAME].document.selection.createRange();
var objectImg = node(0)
} |
Partager