js to read editor height

Last post 05-18-2010, 4:18 AM by Kenneth. 4 replies.
Sort Posts: Previous Next
  •  05-14-2010, 1:32 AM 61012

    js to read editor height

    Is there any js to read editor's height?
    I found a problem, if a editor is in a invisible div, I initiate the editor and then try to resize the height, it doesn't work
     
    Can you provide a client side method to read the height?
     
    thx
  •  05-14-2010, 1:36 AM 61013 in reply to 61012

    Re: js to read editor height

    is there procedure executing when window.onresize happens? I found if I use trigger onresize event, it works~~~
     
    pls help~~~
     
  •  05-17-2010, 1:38 AM 61043 in reply to 61012

    Re: js to read editor height

    wolf11th:
    Is there any js to read editor's height?
    I found a problem, if a editor is in a invisible div, I initiate the editor and then try to resize the height, it doesn't work
     
    Can you provide a client side method to read the height?
     
    thx
     
    Hi wolf11th,
     
    example 1
     
    1. <%@ Page Language="C#" ValidateRequest="false" %>   
    2.   
    3. <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>   
    4. <html>   
    5. <head>   
    6. </head>   
    7. <body>   
    8.     <form id="Form1" runat="server">   
    9.      <input type="button" value="show editor" onclick="show()" />   
    10.         <div id="div1" style="visibility: hidden">   
    11.             <CE:Editor ID="editor1" runat="server">   
    12.             </CE:Editor>   
    13.         </div>   
    14.           
    15.     </form>   
    16. </body>   
    17. </html>   
    18.   
    19. <script>   
    20. var editor1 = document.getElementById("<%= editor1.ClientID %>");      
    21. var div1=document.getElementById("div1");   
    22. function show()      
    23. {      
    24. div1.style.visibility="visible";   
    25.  editor1.SetHeight(1000);   
    26. }    
    27.   
    28. </script>  

    example 2
     
    1. <%@ Page Language="C#" ValidateRequest="false" %>   
    2.   
    3. <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>   
    4. <html>   
    5. <head>   
    6. </head>   
    7. <body>   
    8.     <form id="Form1" runat="server">   
    9.         <input type="button" value="show editor" onclick="show()" />   
    10.         <div id="div1" style=" display:none">   
    11.             <CE:Editor ID="editor1" runat="server">   
    12.             </CE:Editor>   
    13.         </div>   
    14.        
    15.     </form>   
    16. </body>   
    17. </html>   
    18.   
    19. <script>   
    20.   
    21. var div1=document.getElementById("div1");   
    22. function show()      
    23. {      
    24. div1.style.display="block";   
    25.   
    26. }    
    27. function CuteEditor_OnInitialized(editor)   
    28. {   
    29.  editor.SetHeight(1000);   
    30. }     
    31. </script>  
    Regards,
     
    ken
  •  05-18-2010, 1:12 AM 61080 in reply to 61043

    Re: js to read editor height

    thx Ken,
    I know how to set the height
    I need a way to read the height of the editor
    thx again
  •  05-18-2010, 4:18 AM 61088 in reply to 61080

    Re: js to read editor height

    Hi wolf11th,
     
    try
     
    1. <%@ Page Language="C#" ValidateRequest="false" %>   
    2.   
    3. <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>   
    4. <html>   
    5. <head>   
    6. </head>   
    7. <body>   
    8.     <form id="Form1" runat="server">   
    9.         <CE:Editor ID="editor1" runat="server" Height="500">   
    10.         </CE:Editor>   
    11.         <input type="button" value="Get editor height" onclick="getHeight()" />   
    12.       
    13.     </form>   
    14. </body>   
    15. </html>   
    16.   
    17. <script>   
    18. var editor1=document.getElementById("<%= editor1.ClientID %>");   
    19. function getHeight()   
    20. {   
    21. alert(editor1.offsetHeight);   
    22. }   
    23. </script>  
    Regards,
     
    ken
View as RSS news feed in XML