una soluzione buttata li potrebbe essere quella di tenere il doppio backslash prima dell'apice che così non vengono fuori errori e in visualizzazione eliminare il backslash in più
metti all'inizio dello script questa regular expression e sostituisci le due funzioni con queste
codice:
var reSlash = /\\/g
// Create the tree
function createTree(arrName, startNode, openNode) {
nodes = arrName;
if (nodes.length > 0) {
preloadIcons();
if (startNode == null) startNode = 0;
if (openNode != 0 || openNode != null) setOpenNodes(openNode);
if (startNode !=0) {
var nodeValues = nodes[getArrayId(startNode)].split("|");
str = "<a href=\"" + nodeValues[3] + "\" onmouseover=\"window.status='" + nodeValues[2] + "';return true;\" onmouseout=\"window.status=' ';return true;\"><img src=\"img/folderopen.gif\" align=\"absbottom\" alt=\"\" />" + nodeValues[2].replace(reSlash,'') + "</a>
"
document.write(str);
} else document.write("<img src=\"img/base.gif\" align=\"absbottom\" alt=\"\" />HP-DCS
");
var recursedNodes = new Array();
addNode(startNode, recursedNodes);
}
}
// Adds a new node to the tree
function addNode(parentNode, recursedNodes) {
for (var i = 0; i < nodes.length; i++) {
var nodeValues = nodes[i].split("|");
if (nodeValues[1] == parentNode) {
var ls = lastSibling(nodeValues[0], nodeValues[1]);
var hcn = hasChildNode(nodeValues[0]);
var ino = isNodeOpen(nodeValues[0]);
// Write out line & empty icons
for (g=0; g<recursedNodes.length; g++) {
if (recursedNodes[g] == 1) document.write("<img src=\"img/line.gif\" align=\"absbottom\" alt=\"\" />");
else document.write("<img src=\"img/empty.gif\" align=\"absbottom\" alt=\"\" />");
}
// put in array line & empty icons
if (ls) recursedNodes.push(0);
else recursedNodes.push(1);
// Write out join icons
if (hcn) {
if (ls) {
document.write("<a href=\"javascript: oc(" + nodeValues[0] + ", 1);\"><img id=\"join" + nodeValues[0] + "\" src=\"img/");
if (ino) document.write("minus");
else document.write("plus");
document.write("bottom.gif\" align=\"absbottom\" alt=\"Open/Close node\" /></a>");
} else {
document.write("<a href=\"javascript: oc(" + nodeValues[0] + ", 0);\"><img id=\"join" + nodeValues[0] + "\" src=\"img/");
if (ino) document.write("minus");
else document.write("plus");
document.write(".gif\" align=\"absbottom\" alt=\"Open/Close node\" /></a>");
}
} else {
if (ls) document.write("<img src=\"img/joinbottom.gif\" align=\"absbottom\" alt=\"\" />");
else document.write("<img src=\"img/join.gif\" align=\"absbottom\" alt=\"\" />");
}
// Start link
document.write("<a href=\"" + nodeValues[3] + "\" onmouseover=\"window.status='" + nodeValues[2] + "';return true;\" onmouseout=\"window.status=' ';return true;\">");
// Write out folder & page icons
if (hcn) {
document.write("<img id=\"icon" + nodeValues[0] + "\" src=\"img/folder")
if (ino) document.write("open");
document.write(".gif\" align=\"absbottom\" alt=\"Folder\" />");
} else document.write("<img id=\"icon" + nodeValues[0] + "\" src=\"img/page.gif\" align=\"absbottom\" alt=\"Page\" />");
// Write out node name
document.write(nodeValues[2].replace(reSlash,''));
// End link
document.write("</a>
");
// If node has children write out divs and go deeper
if (hcn) {
document.write("<div id=\"div" + nodeValues[0] + "\"");
if (!ino) document.write(" style=\"display: none;\"");
document.write(">");
addNode(nodeValues[0], recursedNodes);
document.write("</div>");
}
// remove last line or empty icon
recursedNodes.pop();
}
}
}
famme sape'