2011-04-13 8 views
0

접을 수있는 중첩 스크립트 Here이 있습니다.자바 스크립트 대체 텍스트

코드에 <ul>Name이 있으면 <ul><a href="#">&plusmn; Name</a>으로 변환됩니다.

그러나, 나는 이미 같은 링크가있는 경우 :

<ul> <a href="#"Name</a> 그것을 내가 그들로 결합하려는

<ul><a href="#">&plusmn; </a> 
    <a href="#">Name</a> 

로 변환됩니다 <ul><a href="#">&plusmn; Name</a>합니다. 어떻게해야할지 모르겠습니다.

나는 당신이 LI를 열고 withot UL 노드에 대한 링크를 배치하려고하는

 //create a link for expanding/collapsing 
     var newLink = document.createElement('A'); 
     newLink.setAttribute('href', '#'); 
     newLink.onclick = new Function('clickSmack(this,' + oLev + ',\'' + oBsID + '\',' + oCol + ',\'' + escape(oT) + '\');return false;'); 
     //wrap everything upto the child U/OL in the link 
     if(oML) { var theHTML = ''; } else { 
      var theT = y[x].innerHTML.toUpperCase().indexOf('<'+oT); 
      var theA = y[x].innerHTML.toUpperCase().indexOf('<A'); 
      var theHTML = y[x].innerHTML.substr(0, (theA + 1 && theA < theT) ? theA : theT); 
      while(!y[x].childNodes[0].tagName || (y[x].childNodes[0].tagName.toUpperCase() != oT && y[x].childNodes[0].tagName.toUpperCase() != 'A')) { 
       y[x].removeChild(y[x].childNodes[0]); } 
     } 
     y[x].insertBefore(newLink,y[x].childNodes[0]); 
     y[x].childNodes[0].innerHTML = oPM + theHTML.replace(/^\s*|\s*$/g,''); 
     theNextUL.MWJuniqueID = oIcount++; 
     compactChildren(theNextUL, oLev + 1, oBsID, oCol, oPM, oT, oML); 

답변

0

으로 뭔가를해야 알아? 브라우저가 자동으로 닫힙니다. UL