OK, I have solved some of the problems here. In my Javascript, I had not allowed for the fact that Mozilla and Opera open the Insert Image dialog asynchronously, so the code has to loop waiting for the user to select an image. In the sample code that ships with CE 6.0, the setTimeout command is used for this purpose (see below).
However, there's still a problem with this. If the user clicks the cancel button on the dialog, the javascript keeps running in a loop until the browser is closed. Apart from being inefficient, this leaves no way of taking an alternative action on cancel, which I need to do. Is there no other way of determining that the dialog has been closed other than testing to see if an image has been selected?
Any help appreciated.
Paul
<Script Language="javascript">
function callInsertImage()
{
var editor1 = document.getElementById('<%=Editor1.ClientID%>');
editor1.FocusDocument();
var editdoc = editor1.GetDocument();
editor1.ExecCommand('new');
editor1.ExecCommand('ImageGalleryByBrowsing');
InputURL();
document.getElementById("imageFld").focus();
}
function InputURL()
{
var editor1 = document.getElementById('<%=Editor1.ClientID%>');
var editdoc = editor1.GetDocument();
var imgs = editdoc.getElementsByTagName("img");
if(imgs.length>0)
{ document.getElementById("imageFld").value = imgs[imgs.length-1].src;
}
else
{
setTimeout(InputURL,500);
}
}
</script>
Paul Taylor
Dotcom Software Solutions