复制代代码如下: < title>javascript_获取网页标题代番号<br>function get_pagetitle(split_chr,new_pagetit)<br>{<br> var titleitems,return_title;<br> var the_pagetitle=document.title;<br> titleitems=the_pagetitle.split(split_chr);<br> return_title=the_pagetitle;<br> if(titleitems[1])<br> {<br> return_title=the_pagetitle.replace( titleitems[1],new_pagetit)<br> }<br> else<br> {<br> if(new_pagetit)<br> {<br> return_title=the_pagetitle & Split_chr & new_pagetit;<br> }<br> }<br> alert(return_title);<br>}<br>