The JS Code is directly written on the master page of Asp.net. The principle is to directly extract the text value of the last element from the "navigation" code of the Web document. 1 // <! [CDATA [
2 (function (){
3 window. addeventlistener? Window. addeventlistener ('load', titleload, false): window. attachevent ('onload', titleload );
4 If (! Document. getelementbyid) return;
5 function titleload (){
6 var otextobj = Document. getelementbyid ('lastnode ');
7 if (! Otextobj) return;
8 stext = otextobj. innerhtml;
9 If (! Stext) return;
10 Document. Title = 'butterfly tree-'+ stext;
11}
12 }());
13 //]>
For HTML code, see "proficient in HTML" 6.4 semantic navigation.
The preceding method has semantics.
Practical application:
Http://demo.idea-source.net/baicheng/cn/index/
The following method is not colloquial:
The sitemappath Server Control in. NET 2.0 generates a span without semantics. 1 // <! [CDATA [
2 (function (){
3 if (! Document. getelementsbytagname) return;
4 var spanelm = Document. getelementsbytagname ('span ');
5 If (! Spanelm) return;
6 For (VAR I = 0; I <spanelm. length; I ++ ){
7 var spanelmofspan = spanelm [I]. getelementsbytagname ('span ');
8 If (! Spanelmofspan) continue;
9 For (var j = 0; j <spanelmofspan. length; j ++ ){
10 spanelmofspan [spanelmofspan. Length-1]. ID = 'lastnode ';
11}
12
13}
14 }());
15 //]>
Practical application:
Http://demo.idea-source.net/hds/cn/index/