Dear Kenneth,
Here are the codes:
- <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>
-
- <html>
- <head>
- <title></title>
-
- <style type='text/css'>
- body
- {
- margin: 0px;
- padding: 0px;
- }
- </style>
-
- <script language="javascript">
- function callInsertFile() {
- var editor = document.getElementById('<%=editor.ClientID%>');
- editor.FocusDocument();
- setTimeout(function() { delay_editor_function(editor) }, 500);
- return false;
- }
-
- function delay_editor_function(editor) {
- editor.ExecCommand('new');
-
- InputURL();
-
- editor.ExecCommand('InsertDocument');
- }
-
- function InputURL() {
- var editor = document.getElementById('<%=editor.ClientID%>');
- var editdoc = editor.GetDocument();
- var links = editdoc.getElementsByTagName("a");
-
- var link_data = "";
- for (var i = links.length - 1; i >= 0; i--) {
- if (links[i].href != "") {
- link_data = links[i].href;
- break;
- }
- }
-
- if (link_data != "") {
- document.getElementById('select_path').value = link_data;
- }
- else {
- setTimeout(InputURL, 500);
- }
- }
- </script>
-
- </head>
- <body>
- <form id="Form1" runat="server">
- <table border="0" cellpadding="0" cellspacing="0">
- <tr>
- <td>
- <CE:Editor id="editor" runat="server" Width="1" Height="1" BackColor="White" BorderColor="White"></CE:Editor>
-
- <input type="button" value="Browse" onclick="return callInsertFile();" id="file_path_btn" style="width:150px;height:30px;"/>
- <br />
- <input type="text" id="select_path" value="" style="width:500px;" />
- </td>
- </tr>
- </table>
- </form>
- </body>
- </html>
P.S.
chrom return error:
Uncaught HierarchyRequestError: Failed to execute 'insertNode' on 'Range': The node to be inserted is a 'A' node, which may not be inserted here.
IE return error:
Object doesn't support property or method 'addEventListener'