我通过在段落中创建变量并将另一个变量插入到一个强元素中来解决这个问题,这对于任何需要它的人来说都是完整的功能。
callrecb0:function(rectxt){
var forumcon0 = document.getElementsByClassName("forumcon0");
var txt0 = rectxt.split(":::");
for(var i=0; i<txt0.length; i++){
var newpara0=document.createElement("p");
forumcon0[0].appendChild(newpara0);
var paras0=forumcon0[0].getElementsByTagName("p");
paras0[i].setAttribute("id", "x"+i);
custevents.addevent(paras0[i], 'click',custevents.forlink0);
var tittxt0 = txt0[i].split("++++")[0];
var txt00 = txt0[i].split("++++")[1];
var limitchars0 = txt00.substring(0,35);
if(limitchars0.length==35){
var limitchars00 = txt00.substring(36,71);
}else{
limitchars00="";
}
var limitchars1 = txt00.substring(71, txt00.length);
//var limitTotatl0 = limitchars0.length+limitchars00.length;
//alert(limitTotal0);
//paras0[i].innerHTML += tittxt0+"<br>"
paras0[i].style.color="Blue";
var codecou0=limitchars1.split("[code]");
if(codecou0.length>1){paras0[i].innerHTML ="[code]" }
if(limitchars00.length >34){
paras0[i].innerHTML += tittxt0+"<br>"
paras0[i].style.color="Blue";
var newpara1=document.createElement("strong");
paras0[i].appendChild(newpara1);
newpara1.style.color="black";
newpara1.innerHTML+=limitchars0+"<br>"+limitchars00+" ...";
}else{
paras0[i].innerHTML += tittxt0+"<br>"
paras0[i].style.color="Blue";
var newpara1=document.createElement("strong");
paras0[i].appendChild(newpara1);
newpara1.innerHTML+=limitchars0+"<br>"+limitchars00;
newpara1.style.color="black";
}
if(i==txt0.length-2){
formstyle.odd();
}
}
},