You wrote: "Yes, it will be available on the server side"
Did you mean "Yes, it will be available on the client side"?
This would be fine ,
but there is no need to hurry, I found a very simple solution (rather a hack):
I put the anchor hidden in the text property:
Nd := NavTree.Items.Add(nil, '<span "' + sAnchor + '">' + sText + '</span>');
and then I can get it like so:
NavTree.ClientEvents.ExtEvents.Values['itemclick'] := 'function itemclick(sender, record, item, index, e, eOpts) {' +
'var iPos = record.data.text.indexOf(">") - 1,' +
' anchor = record.data.text.substring(7, iPos),' +
' elTo = ' + UniURLFrame1.JSName + '.iframe.contentWindow.document.getElementById(anchor);' +
'if (elTo) {' +
' ' + UniURLFrame1.JSName + '.iframe.contentWindow.document.scrollingElement.scrollTop = elTo.offsetTop - 5;' +
'}' +
'}';