Re: Javascript Error when call "editor.ExecCommand('InsertDocument');"

  •  01-19-2016, 10:56 PM

    Re: Javascript Error when call "editor.ExecCommand('InsertDocument');"

    thanks for reply

    it cannot solve the errors because it needs to run "editor.ExecCommand('new')" before to clear the editor content

    because need to use following functions to get the selected file path

     

     

    1. function editor_function() {  
    2.          var editor = document.getElementById('<%=editor.ClientID%>');  
    3.          editor.FocusDocument();  
    4.          editor.ExecCommand('new'); // hide this will be fine but cannot because need to clear the content. for IE still have other error if hiding this  
    5.            
    6.          InputURL();                              
    7.   
    8.          editor.ExecCommand('InsertDocument');  
    9.      }  
    10.   
    11.      function InputURL() {                  
    12.          var editor = document.getElementById('<%=editor.ClientID%>');  
    13.          var editdoc = editor.GetDocument();  
    14.          var links = editdoc.getElementsByTagName("a");  
    15.   
    16.          var link_data = "";  
    17.          for (var i = links.length - 1; i >= 0; i--) {  
    18.              if (links[i].href != "") {  
    19.                  link_data = links[i].href;  
    20.                  break;  
    21.              }  
    22.          }  
    23.   
    24.          if (link_data != "") {  
    25.              document.getElementById('file_path_textfield').value = link_data;  
    26.          }  
    27.          else {  
    28.              setTimeout(InputURL, 500);  
    29.          }  
    30.      }   

     

View Complete Thread