<!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></title>
<script type="text/javascript">
if ("\v" == "v") { // IE浏览器
alert("我是ie");
}
else { // 非IE浏览器
alert("我是其他浏览器");
};
</script>
</head>
<body>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script type="text/javascript">
if ("\v" == "v") { // IE浏览器
alert("我是ie");
}
else { // 非IE浏览器
alert("我是其他浏览器");
};
</script>
</head>
<body>
</body>
</html>
本文通过一个简单的 JavaScript 脚本示例介绍了如何判断用户的浏览器是否为 IE 浏览器。此方法利用了 IE 浏览器对某些字符串处理方式的独特性。
446

被折叠的 条评论
为什么被折叠?



