-5

こんにちは最初に(Jezen Thomas tyあなたのコードは私を助けますが、私はそれを使用できません)、私はjqueryを呼び出さずにこのコードを機能させる必要があります(サポートされるかどうかわからないため)、基本的に私はこのコードをhtmlとjavascriptのみを使用して、ieバージョンを表示します

<html> 
<!--[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>
<title>A HTML document needs a title to be valid.</title>
</head>
<body>
<script type="text/javascript"> 
window.onload = function mytest(){
"use strict";
// Detecting IE
var oldIE
if ($('html').is('.ie6, .ie7, .ie8')) {
oldIE = 1;
    }

if (oldIE == 1) {
   document.write("version<ie9")
    } else {
   document.write(" version => ie9")
}
}
</script>
</body>
</html>

($)を削除する必要がありますが、何を置き換えるかわかりません(最近javascriptを開始しました)

4

1 に答える 1

1

alert(navigator.userAgent);

それがあなたに必要なスタートを与えることを願っています。

于 2013-01-29T17:06:32.350 に答える