SPAW editor. Net edition V.2 useless: Use code to adjust the editor height

Source: Internet
Author: User

SPAW editor. Net edition V.2 describes an HTML editor, which may be used for page layout.CodeControl the editor size. For example, when you adjust the browser size, you may want the editor size to change with the browser size. The default width attribute of SPAW editor is 100%, so we need to consider how to adjust the height of the control using code.

OK. Suppose there is a server-side SPAW editor control with ID spawmain on the page. How can we use the browser-side Javascript script to control the height of the control? If you have enough foundation and patience, you can read the SPAW editor.. net source code. Otherwise, it is recommended that you use a browser development auxiliary tool similar to IE developer toolbar to view HTML Dom on the browser side. Through the IE developer toolbar, we can clearly see (figure) that the SPAW editor subject is also an IFRAME element without exception. Through observation, you can also find that the IFRAME and the toolbar and status bar of the control are all placed in the cell of the table element, so the problem of adjusting the editor height becomes the problem of adjusting the height of the IFRAME element. Adjust the height of an IFRAME element on the HTML page. We need to know the ID attribute value of this IFRAME element. In this example, we can see that the ID attribute value of this IFRAME element is spawmain_redit, the format is "[server-side control ID attribute value] _ redit", which is located in the spaw2/JS/common/Editor directory. the following code in js also verifies this point:

// Returns reference to outer IFRAME object (differs from getpageifram in IE only)
Spaweditor. Prototype. getpageiframeobject =   Function (Page_name)
{
Return   This . Document. getelementbyid (Page_name + '_ redit' );
}

 

Now, on the browser side, we can use the following JavaScript code to change the height of the element:

 

Document. getelementbyid ( " [Server-side control ID attribute value]_ Redit " ). Style. Height =  [Set the height value];

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.