티스토리 뷰
// mTree
var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
xmlDoc.async = "false";
xmlDoc.load("/login@admin/_js/mTree.xml");
xmlData = xmlDoc.documentElement;
var returnStr = "";
function mTree() {
startmTree();
menumTree();
endmTree();
return returnStr;
}
function menumTree() {
returnStr += xmlData.childNodes(0).getAttribute("name");
returnStr += xmlData.childNodes(0).childNodes(0).getAttribute("name");
returnStr += xmlData.childNodes(1).getAttribute("name");
returnStr += xmlData.childNodes(1).childNodes(0).getAttribute("name");
returnStr += "<br />";
returnStr += xmlData.childNodes(1).childNodes.length;
}
function startmTree() {
returnStr += "<div>";
}
function endmTree() {
returnStr += "</div>";
}
---------------------------------------------------------------------------------------------------------------------------
// xml
< xml>
<data name="냥냥" url="url1">
<data1 name="냥냥1" url="url11" />
</data>
<data name="킁킁" url="url2">
<data1 name="킁킁1" url="url21" />
<data1 name="킁킁2" url="url22" />
</data>
< /xml>
---------------------------------------------------------------------------------------------------------------------------
// HTML
< td>
<SCRIPT language="javascript" type="text/javascript" src="/login@admin/_js/mTree.js"></SCRIPT>
<SCRIPT>document.write(mTree())</SCRIPT>
< /td>
'Language > JavaScript_JS' 카테고리의 다른 글
[ JavaScript ][ JS ] pageNevi(nowPage, totalNum, pLimit, bLimit); (0) | 2015.11.29 |
---|---|
[ JavaScript ][ JS ] 도메인, 현재페이지 경로 구하기 / domain URL location href (0) | 2015.11.29 |
[ JavaScript ][ JS ] keyEvent // enterEvent (0) | 2015.11.29 |
[ JavaScript_JS ] marquee - text 문자 롤링 (0) | 2015.11.29 |
[ JavaScript_JS ] 단축키 지정 - Shortcuts (0) | 2015.11.29 |