Re: Select image with ExecCommand('insertimage') and write path to textbox

  •  05-20-2008, 11:26 AM

    Re: Select image with ExecCommand('insertimage') and write path to textbox

    I'm using master pages on the site and have to use getElementById("ctl00_ContentPlaceHolder1_imageFld")
    Okay this works:
      function callInsertIMG() 
        { 
       var editor2 = document.getElementById('<%=editor2.ClientID%>');
                editor2.FocusDocument(); 
                var editdoc = editor2.GetDocument(); 
                editor2.ExecCommand('new');
                editor2.ExecCommand('InsertImage');
                InputIMG();
                document.getElementById("ctl00_ContentPlaceHolder1_imageFld").focus();
        }   
       
        function InputIMG()
        {
      var editor1 = document.getElementById('<%=Editor2.ClientID%>');
            var editdoc = editor1.GetDocument(); 
            var imgs = editdoc.images;
            if(imgs.length>0) 
            { document.getElementById("ctl00_ContentPlaceHolder1_imageFld").value = imgs[imgs.length-1].src;
       document.getElementById("ctl00_ContentPlaceHolder1_imageFld").focus();
            } 
            else
            {
       setTimeout(InputIMG,500);
            } 
        } 
     
    I'm considering other alternatives to storing and referencing the images and documents for content management.
    I have an sqlexpress data store.  Thought of storing the path to magazine cover image, path to pdf, title of the magazine, short description of main article, etc.
    Wanted to control the size of the image uploaded.
    Need the alt tag filled in for accessibility compliance.
    Does the above script allow the capture of the alt tag that I could send to a textbox value?
    Thanks.
View Complete Thread