<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Hello,IIS</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<script type="text/javascript">
function fu() {
if (navigator.userAgent.indexOf("MSIE") > 0) {
alert("MSIE");
}
else if (isFirefox = navigator.userAgent.indexOf("Firefox") > 0) {
alert("FireFox");
}
}
</script>
</div>
</form>
<input type="button" value="TestBrows" onclick="fu()" />
</body>
</html>
然 后放在本地的IIS或者Apache目录下,运行一下试试看。
![](http://img.zemanta.com/pixy.gif?x-id=66c2b20d-1725-807c-9983-649cdea151d7)