Re: Customised image selector unable to work in Chrome v13.0.782.220 m

  •  09-15-2011, 8:23 PM

    Re: Customised image selector unable to work in Chrome v13.0.782.220 m

    Hi Kenneth,
     
    Thanks for your help. I've changed my image selector to using the gallery as your code suggested and it worked. I did make some changes as I had to include many instances of the images selector in a single page. Below is my final codes for all to reference.
     
    <table border="0" cellpadding="0" cellspacing="0">
    <tr>
     <td valign="top">
            <div style="position:absolute;z-index:-100">
       <CE:Editor id="HtmlEditor" URLType="SiteRelative" UseRelativeLinks="true" runat="server" Width="1" Height="1" AutoConfigure="None" ShowHtmlMode="False" ShowPreviewMode="False" EnableContextMenu="false" ShowGroupMenuImage="False" ShowBottomBar="False" BackColor="White" BorderColor="White"></CE:Editor><div style="display:none"><asp:TextBox ID="uiSource" runat="server" Text="foo" /></div>
      </div>
      <asp:TextBox id="imageFld" runat="server" />
      <INPUT type="button" value="Select Image" class="<%=styleFile %>" onclick="<%=HtmlEditor.ClientID%>callInsertImage()" id="Insert Image" NAME="Insert Image">
          
     </td>
    </tr>
    </table>
    <script language="javascript">
        function <%=HtmlEditor.ClientID%>callInsertImage()
        {
         var editor1 = document.getElementById('<%=HtmlEditor.ClientID%>');
            editor1.FocusDocument();
            var editdoc = editor1.GetDocument();
            editor1.SetHTML("");
            editor1.ExecCommand('ImageGalleryByBrowsing');
            <%=HtmlEditor.ClientID%>InputImageURL();
        }
        function <%=HtmlEditor.ClientID%>InputImageURL()
        {
            var editor1 = document.getElementById('<%=HtmlEditor.ClientID%>');
            editor1.FocusDocument();
            var editdoc = editor1.GetDocument();
            var imgs = editdoc.images;
            if(imgs.length>0)
            {
                var path1=imgs[imgs.length-1].src.split('cmsresource/');
                editor1.ExecCommand('new');
                document.getElementById('<%=imageFld.ClientID%>').value = path1[1];
                document.getElementById('<%=uiSource.ClientID%>').value = path1[1];
                document.getElementById('<%=imageFld.ClientID%>').focus();
            }
            else
            {
                setTimeout(<%=HtmlEditor.ClientID%>InputImageURL,500);
            }
        }
    </script>
View Complete Thread