我正在尝试添加一个额外的文本区域,因此我需要复制此代码的一部分,但我不确定哪个部分。 有人可以帮忙吗?
function mode_add_message()
{
jQuery("#editor").hide();
jQuery("#cropper").hide();
jQuery("#crop_preview_container").hide();
jQuery("#pxn8_canvas").show();
jQuery("#messages").empty();
jQuery("#edit_and_crop").show();
jQuery("#add_text").show("slow");
gAddTextOpNumber = PXN8.opNumber;
if (gCardDB[gActiveCard].text_placeholders){
var placeholders = gCardDB[gActiveCard].text_placeholders;
for (var i = 0;i < placeholders.length; i++){
var text = placeholders[i];
var html = "";
if (text.multiline){
html = "<li><textarea name=\"text_" + i + "\" id=\"text_" + i + "\">Message # " + (i+1) + " Here</textarea></li>";
}else{
html = "<li><input class=\"text\" type=\"text\" name=\"text_" + i + "\" id=\"text_" + i + "\" value=\"Message # " + (i+1) + " here\"></li>";
}
jQuery(html).appendTo("#messages");
}
}else{
end_cardmaker();
}
}
//
// There can be multiple text inputs/textareas so each must be added.
这是网址:http://pixenate.com/pixenate/themes/cardmaker/index.php
答案 0 :(得分:0)
这部分代码将帮助您添加textarea:
if (gCardDB[gActiveCard].text_placeholders){
var placeholders = gCardDB[gActiveCard].text_placeholders;
for (var i = 0;i < placeholders.length; i++){
var text = placeholders[i];
var html = "";
if (text.multiline){
html = "<li><textarea name=\"text_" + i + "\" id=\"text_" + i + "\">Message # " + (i+1) + " Here</textarea></li>";
}else{
html = "<li><input class=\"text\" type=\"text\" name=\"text_" + i + "\" id=\"text_" + i + "\" value=\"Message # " + (i+1) + " here\"></li>";
}
jQuery(html).appendTo("#messages");
}
}else{
end_cardmaker();
}
但我不确定这些条件是什么,因为我没有看过你的整个代码。只需添加textarea即:
var html = '<li><textarea name="" id="">Message #1 Here</textarea></li>';
jQuery(html).appendTo("#messages");