Re: problem in IE with getSelectedHTML()

  •  02-18-2009, 3:38 PM

    Re: problem in IE with getSelectedHTML()

    1. function getSelectedHTML()   
    2. {      
    3.       var rng=null,html="";   
    4.       var editdoc = editor1.GetDocument();   
    5.       var editwin = editor1.GetWindow();   
    6.       if (document.selection && document.selection.createRange)   
    7.       {      
    8.             rng=editdoc.selection.createRange();   
    9.         if( rng.htmlText )    
    10.             {    
    11.         html=rng.htmlText;    
    12.         }    
    13.         else if(rng.length >= 1)    
    14.         {    
    15.               html=rng.item(0).outerHTML;    
    16.             }   
    17.       }   
    18.         else if (window.getSelection)   
    19.       {   
    20.             rng=editwin.getSelection();   
    21.             if (rng.rangeCount > 0 && window.XMLSerializer)   
    22.             {   
    23.                   rng=rng.getRangeAt(0);   
    24.                   html=new XMLSerializer().serializeToString(rng.cloneContents());   
    25.             }   
    26.       }   
    27.       return html;   
    28. }  

    asp.net Chat http://cutesoft.net/ASP.NET+Chat/default.aspx
    Web Messenger: http://cutesoft.net/Web-Messenger/default.aspx
    asp.net wysiwyg editor: http://cutesoft.net/ASP.NET+WYSIWYG+Editor/default.aspx
    asp wysiwyg html editor: http://cutesoft.net/ASP
    asp.net Image Gallery: http://cutesoft.net/ASP.NET+Image+Gallery/default.aspx
    Live Support: http://cutesoft.net/live-support/default.aspx

View Complete Thread