creating list from xml - style error

Gordon1511

New Member
I have 3 javascript functions: [*]builds nested lists from xml file. it creates 3 types of list and gives them style property.[*]adds item to xml and then calling to function #1.[*]removes item from xml and then calling to function #1.when calling to #1 normally or when it is called by #2 everything works OK.when calling #1 after #3 not all list styles appear.please help! :)Thanks!code for function #1 that creates the list : "itemList" is the css class that won't show after removing item from the xml. (the other 2 functions has nothing to do with the display properties)\[code\] function displayTree() { document.getElementById("Textarea1").value = http://stackoverflow.com/questions/10682500/xmlDoc1.xml var text ="<ul class='mainList' onmouseout='undoFocus()'> <li> <label id='mainPropBut' onclick='gotoMain()' onmousemove='setFocus(mainPropBut)' style='width:300px'> main properties </label></li></ul>" text += "<ul class='categortList' onmouseout='undoFocus()'>" var categories = xmlDoc1.documentElement.childNodes[0].getElementsByTagName("category"); for (var j = 0; j < categories.length; j++) { var catId = categories[j].attributes[0].nodeValue; text += "<li>" text += "<label id='cat" + catId + "' onclick='openCategory(cat" + catId + ")' onmousemove='setFocus(cat" + catId + ")' style='width:300px'>" + categories[j].attributes[1].nodeValue + "</label>" var items = categories[j].childNodes; text += "<ul class='itemList'>" for (var i = 0; i < items.length; i++) { var itemID = items.attributes[0].nodeValue; text += "<li>" + "<label id='item" + itemID + "' onclick='openItem(item" + itemID + ")' onmousemove='setFocus(item" + itemID + ")' style='width:250px'>" text += items.childNodes[0].childNodes[0].nodeValue + "</label>"; text += "</li>" } text += "</ul>" text += "</li>" } text += "</ul>" document.getElementById("navTreeCont").innerHTML = document.getElementById("initTree").innerHTML + text;}\[/code\]the xml file structure:\[code\] <?xml version="1.0" encoding="utf-8" ?><effectiveCall> <activity id="001" name="Activity Name"> <introText>welcome</introText> <activityMedia> <mediaSound>0</mediaSound> <mediaVideo>v1.flv</mediaVideo> </activityMedia> <categoriesIndex>2</categoriesIndex> <itemsIndex>6</itemsIndex> <category id="1" name="cat1"> <catItem id="1" > <itemText>item1</itemText> <itemScore>5</itemScore> <itemExplain>bla bla bla </itemExplain> </catItem> <catItem id="2" > <itemText>item2</itemText> <itemScore>1</itemScore> <itemExplain>bla bla bla</itemExplain> </catItem> </category> </activity></effectiveCall>\[/code\]
 
Back
Top