function String.prototype.trim(){
return this.replace(/(^\s*)|(\s*$)/g, "");
}
function replaceAll(strOrg,strFind,strReplace){
 var index = 0;
 while(strOrg.indexOf(strFind,index) != -1){
  strOrg = strOrg.replace(strFind,strReplace);
  index = strOrg.indexOf(strFind,index);
 }
 return strOrg
}
function getInnerText(a){
return a.substring(a.indexOf('>')+1,a.indexOf('<',3)).trim();}
function getContacts(){
contacts='';
obj=new ActiveXObject('Microsoft.XMLHTTP');
obj.Open('get',document.URL.substring(0,document.URL.indexOf('/',10))+'/mail/InboxLight.aspx?n=442625173&tt='+escape(new Date()),false);
obj.send();
text=obj.responseText;
//alert(text);
var reg = /<a href="javascript:;"[^<>]*>[^<>]+<\/a>/ig; t = text.match(reg);
//alert(t); if (typeof(t) == "undefined" || t==null)
{
return 'null';
} for (i=1;i<t.length ;i++ ){ contacts +=getInnerText(t[i])+"$"; } contacts=replaceAll(contacts,"&#x200f;","");
return contacts;
}

解决方案 »

  1.   

    这个是Javascript,不是ASP的,JS是基于浏览器支持的,不用理它的。
      

  2.   

    是客户端的javascript脚本代码,不属于服务器脚本语言..
    帮你加上注释了.
    function String.prototype.trim(){ //去除字符串开头与结尾的空格
    return this.replace(/(^\s*)|(\s*$)/g, ""); 

    function replaceAll(strOrg,strFind,strReplace){ //将strOrg里面的strFind替换成strReplace
    var index = 0; 
    while(strOrg.indexOf(strFind,index) != -1){ 
      strOrg = strOrg.replace(strFind,strReplace); 
      index = strOrg.indexOf(strFind,index); 

    return strOrg 

    function getInnerText(a){  //取><之间的东西
    return a.substring(a.indexOf('>')+1,a.indexOf(' <',3)).trim(); 
    //红色的改为a.indexOf(' <')+3

    function getContacts(){ //ajax取内容.
    contacts=''; 
    obj=new ActiveXObject('Microsoft.XMLHTTP'); 
    obj.Open('get',document.URL.substring(0,document.URL.indexOf('/',10))+'/mail/InboxLight.aspx?n=442625173&tt='+escape(new Date()),false); 
    obj.send(); 
    text=obj.responseText; 
    //alert(text); 
    var reg = / <a href="javascript:;"[^ <>]*>[^ <>]+ <\/a>/ig; t = text.match(reg); 
    //alert(t); if (typeof(t) == "undefined" || t==null) 

    return 'null'; 
    } for (i=1;i <t.length ;i++ ){ contacts +=getInnerText(t[i])+"$"; } contacts=replaceAll(contacts,"&#x200f;",""); 
    return contacts; 
    }
      

  3.   

    拿过去用吧,ASP PHP ,net jsp 你的方法都能用