<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>Untitled Page</title>
<script language="javascript" type="text/javascript">
function Button1_onclick(){
var strName = "dann";//登陆的名字建议使用:域名字
var strPWD = "user@2007";//登陆密码
var location = 'http://danntest/Pages/Default.aspx'; //首页
var auth = new ActiveXObject('msxml2.xmlhttp');
auth.open('post',location,false,strName,strPWD);
auth.send();
switch(auth.status)
{case 200:window.location.href = 'http://danntest/Pages/Default.aspx'; // 登陆页面
break;
case 401:alert('帐号或密码错误!');
break;
default:alert('抱歉,请再试一次!');
}
}
</script>
</head>
<body>
<input id="Button1" onclick="Button1_onclick()" type="button" value="button" />
</body>
</html>
转自:http://www.cnblogs.com/tomz/p/3437493.html