好的,我有这段代码(我从 Paul irish 页面获得+一些修改)(它为您提供了您的 ie 版本(标准内容):
<!--[if lt IE 7 ]> <html class="ie6"> <![endif]-->
<!--[if IE 7 ]> <html class="ie7"> <![endif]-->
<!--[if IE 8 ]> <html class="ie8"> <![endif]-->
<!--[if IE 9 ]> <html class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html class=""> <!--<![endif]-->
<head>
</head>
<body>
<h1>test:</h1>
<script type="text/javascript">
$(function test()) {
"use strict";
// Detecting IE
var oldIE
if ($('html').is('.ie6, .ie7, .ie8')) {
oldIE = true;
}
if (oldIE) == true {
document.write("version<ie9")
} else {
document.write(" version => ie9")
}
}
</script>
<script type="text/javascript">
<button type="button" onclick="test()">testing</button>
</script>
</body>
</html>
问题是它没有显示测试按钮