如何编写远程登陆MOSS的代码

网络整理 - 07-27

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

  <html  >

  <head>

  <title></title>

  <script language="javascript"  type="text/javascript">

  var objXmlHttp = null;

  function DoSend(url)

  {

  var strUser = document.getElementById("username").value;

  var strPwd = document.getElementById("password").value;

  setTimeout("dodo('"+url+"','"+strUser+"','"+strPwd+"')",80);

  }

  function dodo(url, struser, strpwd)

  {

  var objXmlHttp = new ActiveXObject('MICROSOFT.XMLHTTP');

  try

  {

  objXmlHttp.open("GET", "" + url, false, struser, strpwd);

  objXmlHttp.send();

  if (objXmlHttp.status =="200" && objXmlHttp.readyState ==4) {

  window.location.href = "";

  }

  else

  {

  alert("请输入正确的账号密码!");

  return false;

  }

  }

  catch (em)

  {

  alert(em.message);

  }

  }

  </script>

  </head>

  <body>

  <div>

  <form  method="post">

  用户名:

  <input id="username" type="text"  onkeypress="if(event.keyCode=='13'){document.getElementById('password').focus();}"/><br /><br />

  密码:

  <input id="password" type="text" onkeypress="if(event.keyCode=='13'){document.getElementById('btnLogin').click();}"/><br /><br /><br />

  <input id="btnLogin" type="button" value="登  陆"  onclick="return  DoSend('Http://sharepoint/');" /><br />

  </form>

  </div>

  <p>

   </p>

  </body>

  </html>