qwe88,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<script>
window.addEventListener("DOMContentLoaded", function() {
var ul = document.querySelector("#hmenu"),
a = ul.querySelectorAll("a"),
parent = ul.parentNode;
[].forEach.call(a, function(el) {
var str = "";
var target = el.parentNode;
while (target != parent) {
if (target.tagName == "UL") str += "-";
target = target.parentNode
}
el.text = str + el.text
})
});
</script>
</head>
<body>
<ul id="hmenu">
<li><a>Text_1</a>
</li>
<li><a>Text_2</a>
<ul>
<li><a>1</a>
</li>
<li><a>2</a>
<ul>
<li><a>a</a>
</li>
<li><a>b</a>
</li>
<li><a>c</a>
</li>
</ul>
</li>
<li><a>3</a>
</li>
</ul>
</li>
<li><a>Text_3</a>
</li>
</ul>
</body>
</html>