网页中调用MSN添加好友工具

本文介绍了一个使用JavaScript编写的函数,该函数可以根据不同的服务器类型(如字典、游戏、论坛)来添加预设的MSN账号为联系人。通过检测MSN客户端的状态,函数能够智能地处理各种情况,包括提示用户手动添加账号或者直接通过API调用添加。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

<object id=MsgrUIA classid=clsid:B69003B3-C55E-4b48-836C-BC5946FC3B28 codeType=application/x-oleobject width=0 height=0></object>
 
 
js
 
function addMSN(server_type)
{
 //alert(server_type);
 //return;
 
 var address;
 
 if(server_type == "DICT")
 {
  address = "dict002@msndoor.com";
 }
 else if(server_type == "GAME")
 {
  address = "game001@msndoor.com";
 }
 else if(server_type == "BBS")
 {
  address = "bbs001@msndoor.com";
 }
 
 try
 {
    if("undefined" == typeof(MsgrUIA))
     throw 0;
    if(MsgrUIA.MyStatus == 1)
    {
      MsgrUIA.SignIn(0,'','');
      throw 1;
    }
    MsgrUIA.AddContact(0, address);
  }
  catch(e)
  {
    switch(e)
    {
     case 0:
      //alert("fail0: state_code=" + MsgrUIA.MyStatus);
      alert("您没有安装MSN,如果已经安装MSN,请手动添加帐号: " + address  );
      break;
     case 1:
      //alert("fail1: state_code=" + MsgrUIA.MyStatus);
      alert("您的MSN没有登陆,请登陆");
      break;
     default:
      //alert("unknow fail: state_code=" + MsgrUIA.MyStatus);
      alert("请手动添加MSN帐号: " + address  );
      break;
    }
 }
 return;
 
 if(MsgrUIA.MyStatus == 1)
 {
  alert("您的MSN没有登陆,请登陆");
 }
 else if(MsgrUIA.MyStatus == 2 || MsgrUIA.MyStatus == 10 || MsgrUIA.MyStatus == 14 || MsgrUIA.MyStatus == 34 || MsgrUIA.MyStatus == 50 || MsgrUIA.MyStatus == 66 || MsgrUIA.MyStatus == 6)
 {  
  //2,10, 14, 34, 50,66,6
  MsgrUIA.AddContact(0, address);
 }
 else if(MsgrUIA.MyStatus == 512 || MsgrUIA.MyStatus == 768)
 {
  alert('fail2');
 }
 else
 {
  alert("您没有安装MSN,如果您已经安装MSN,请手动添加3: " + address  );
 }
}
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值