简体   繁体   English

为什么我不能获得价值FCKeditor的。 在他们的代码示例[Javascript]之后完成

[英]Why can't I get value fckeditor. done after their code example [Javascript]

I wonder why I can't get value from FCKEditor with this javascript? 我不知道为什么我无法使用此JavaScript从FCKEditor获得价值? I work with asp.net so I know the controls get different names, mine is in a placeholder and in a usercontrol. 我使用asp.net,所以我知道控件使用不同的名称,我的控件位于占位符和用户控件中。 How should I approach it to find the FCKEditor? 我应该如何看待它找到FCKEditor的?

thx 谢谢

function test()
{
    var oEditor = FCKeditorAPI.GetInstance('FCKeditor1');
    var pageValue = oEditor.GetHTML();

    alert(pageValue);
}
FCKeditorAPI.GetInstance('<%=FCKeditor1.ClientID%>')

This should work, but the problem is that using this approach you can not have this function in external JavaScript file. 这应该可以工作,但是问题是,使用这种方法无法在外部JavaScript文件中使用此功能。 It has to be inline in your asp.net page. 它必须在您的asp.net页面中内联。

function test()
{
    var oEditor = FCKeditorAPI.GetInstance(<%= FCKeditor1.ClientID%>);
    var pageValue = oEditor.GetHTML();

    alert(pageValue);
}

ASP.NET generates different IDs to the ones you use based on their position within the DOM. ASP.NET根据您在DOM中的位置生成与您使用的ID不同的ID。 You should use the ClientID from within the client code to get at the actual ID, but without seeing the mark-up I can't tell for sure. 您应该使用客户端代码中的ClientID来获取实际的ID,但看不到我无法确定的标记。

i tried this code an it work 我尝试了这段代码,它的工作

FCKeditorAPI.GetInstance('ctl00_ContentPlaceHolder1_ctl00_FCKeditor1'); 

i tried 我试过了

FCKeditorAPI.GetInstance('<%=FCKeditor1.ClientID%>')

thing that last wont work cause i got page - usercontrol - fckeditor so the intellesence wont show the fckeditor. 上次无法正常工作的原因是导致我得到了页面-usercontrol-fckeditor,因此,智能不会显示fckeditor。 i would like to make it work with the last one so i dont have to put the "ctl00_ContentPlaceHolder1_ctl00_FCKeditor1" 我想使其与最后一个一起使用,因此我不必放入“ ctl00_ContentPlaceHolder1_ctl00_FCKeditor1”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM