HtmlBox set_text 函数不执行任何操作
我对这段代码有一些问题吗?这是我的代码,
var box;
...
box = jQuery("#text_vesti").htmlbox({
toolbars:[
[
// Cut, Copy, Paste
"cut","copy","paste",
// Undo, Redo
"undo","redo",
// Bold, Italic, Underline,
"bold","italic","underline"
],
[
// Left, Right, Center, Justify
"justify","left","center","right",
// Ordered List, Unordered List
"ol","ul",
// Hyperlink, Remove Hyperlink, Image
"link","unlink","image"
],
[// Show code
"code",
// Formats, Font size, Font family, Font color, Font, Background
"fontsize","fontfamily",
],
],
skin:"silver",
icons:"silk"
});
它从创建编辑器的区域创建文本编辑器,一切都可以,但是......在某些时候,我必须将文本放入编辑器中以重新编辑文本,并且我使用此功能......
function editujOvo (id){
editovanje = true;
id_za_editovanje = id;
jQuery("#r" + pom).css({"background":"none"});
jQuery("#r" + id).css({"background":"#dfdfdf"});
pom = id;
var podaci = "br=3&id=" + id;
// alert(podaci);
jQuery.post("ajax_exe.php", podaci,function(data){
//alert(data.id);
// alert(data.naslov);
alert(data.content);
document.getElementById("naslov_vesti").value = data.naslov;
//document.getElementById("text_vesti").value = data.content;
box=set_text(data.content);
document.getElementById("date").value = data.datum;
window.frames["news_page"].location.reload();
},'json');
}
但它什么也不做,在“set_text”函数之前发出警报告诉我数据存在并且格式正确,但缺少某些内容......有什么想法吗???
------------ 第二个问题?在这个版本中,或者只是在我的代码中,粗体按钮第一次就可以了,但是如果我按下它使文本恢复正常,它什么也不做,实际上它设置了一对 文本周围的标签(在 html 预览中显示).. 在 HtmlBox 插件的代码中我可以修复此功能.... 任何一个??? tnx..
I have some problems with this code? Here is my code that creates text editor from area
var box;
...
box = jQuery("#text_vesti").htmlbox({
toolbars:[
[
// Cut, Copy, Paste
"cut","copy","paste",
// Undo, Redo
"undo","redo",
// Bold, Italic, Underline,
"bold","italic","underline"
],
[
// Left, Right, Center, Justify
"justify","left","center","right",
// Ordered List, Unordered List
"ol","ul",
// Hyperlink, Remove Hyperlink, Image
"link","unlink","image"
],
[// Show code
"code",
// Formats, Font size, Font family, Font color, Font, Background
"fontsize","fontfamily",
],
],
skin:"silver",
icons:"silk"
});
it's create editor and it's all ok, but...in some moment I have to put text in editor to re-edit text and I use this function...
function editujOvo (id){
editovanje = true;
id_za_editovanje = id;
jQuery("#r" + pom).css({"background":"none"});
jQuery("#r" + id).css({"background":"#dfdfdf"});
pom = id;
var podaci = "br=3&id=" + id;
// alert(podaci);
jQuery.post("ajax_exe.php", podaci,function(data){
//alert(data.id);
// alert(data.naslov);
alert(data.content);
document.getElementById("naslov_vesti").value = data.naslov;
//document.getElementById("text_vesti").value = data.content;
box=set_text(data.content);
document.getElementById("date").value = data.datum;
window.frames["news_page"].location.reload();
},'json');
}
but it does nothing, alert just before "set_text" function tels me that data exists and it is in right form and all, but something is missing.... any ideas????
------------ And second question? in this version, or just in mine code, bold button first time does ok, but if I press it to return text to normal, it does nothing, actualy it sets one more pair of <b></b>
tags around text (it's shown in html preview).. where in code of HtmlBox plugin I can repair this function.... any one???? tnx..
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
set_text 应该是一个全局函数?
我无法定义它并且 htmlbox 插件使用
很好的封装,所以我不认为它具有全局函数。
也许 set_text 是盒子的一个方法???
就像
set_text 函数来自哪里?
set_text is suposed to be a global function?
i cant se it defined and the htmlbox plugin uses
nice encapsulation so i dont se it having global functions.
maybe the set_text is a method of the box?????
like
where is the set_text function from??
存储从 jQuery 函数返回的对象,如下所示:
但你可以这样做:
或者那样
Store object return from jQuery function like that:
But you may do like that:
Or like that