在 CKEditor 对话框中引用文本输入字段
我已经玩了几个星期了,但没有成功...
在 CKEditor 对话框中,文本输入字段用唯一的数字重命名 - 例如 id: 'txtUrl' 将变成 id='27_textinput' 之类的内容。
我该如何引用这个?
// I feel it should be something like:
var myfield = CKEDITOR.instances.myElement.document.$.body.getId('txtUrl');
// or maybe:
var myfield = CKEDITOR.dialog.getContentElement('info','txtUrl');
// and then:
myfield.value = 'myvalue';
但这些都不起作用。请帮忙!预先感谢,R
I've been playing around with this for a couple of weeks now with no success...
In a CKEditor dialog, text input fields are renamed with a unique number - e.g. id: 'txtUrl' will become something like id='27_textinput'.
How do I reference this?
// I feel it should be something like:
var myfield = CKEDITOR.instances.myElement.document.$.body.getId('txtUrl');
// or maybe:
var myfield = CKEDITOR.dialog.getContentElement('info','txtUrl');
// and then:
myfield.value = 'myvalue';
But these don't work. Please help! Thanks in advance, R
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(5)
这是最终的解决方案:
This was the final solution:
在我现在使用的元素的 onchange 部分内
,它给出“cke_117_select”作为结果。 (这是一个选择框)
给出“cke_107_textInput”。
我认为这就是您(或此页面的其他访问者)正在寻找的内容。
within an onchange part of an element I now use
and it gives 'cke_117_select' as a result. (It's a selectbox)
gives 'cke_107_textInput'.
I think this is what you (or other visitors to this page) are looking for.
您有一个包含 CKEditor 3 的页面和一个弹出对话框。您可以从此对话框中打开另一个弹出窗口,即 JSP 页面。为了给 CKEditor 父窗口对话框中的字段设置值,请执行以下操作:
这适用于 CKEditor 3。
You have a page containing the CKEditor 3 and a dialog pop up. You open from this dialog, another pop up window, that is a JSP page. In order to set a value to a field in the dialog of CKEditor's parent window, you do the following:
This applies to CKEditor 3.
查看 api 对话框示例:
Look at the api dialog sample:
获取
和设置
get
and set