FCK Editor Focus Issues _ Web page Editor

Source: Internet
Author: User
First question: Time processing

When the page just loaded the FCK assignment value, such as in the information list select a piece of information to view or modify, when the information is added with FCK edit, load the page will load the FCK editor, this time will report an error: "Fckeditorapi undefined", This is why this error occurs because the FCKEDITORAPI is not yet created when the page load is assigned to FCKEDITORAPI. So how do we solve it?

We can do a mountain time processing on it:

ID: Control Id,data: Content assigned to a control

function SetData (id,data) {
if (typeof Fckeditorapi = = "undefined" | |! Fckeditorapi.getinstance (ID). Editingarea) {
settimeout (function () {SetData (id,data);}, 500);
Return
}
Fckeditorapi.getinstance (ID). EditorDocument.body.innerHTML = data;
settimeout (function () {fckeditorapi.getinstance (ID). Focus (); }, 100);
}

That's OK,,>.<.

Second place: Assigning a DOM object

We typically use Fckeditorapi.getinstance ("Control ID") when assigning values. Sethtml ("assignment string") for assignment, which is also true, but when the page is loaded, this assignment is not.

If you do this, you will find that the control of the mouse focus is a problem, get the focus is not available, this time to use a different assignment, the control of the DOM object assignment:

Fckeditorapi.getinstance ("Control ID"). EditorDocument.body.innerHTML = "Assignment string";

This gives the value of the focus back to normal.

Encounter this problem when also depressed for a long time, hope to use FCK friend to encounter such problems a little help.

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.