我有这段代码来确定java值。
<!DOCTYPE html>
<html>
<body>
<p id="demo">Click the button to determine whether your browser has Java enabled.</p>
<button onclick="myFunction()">click mee </button>
<script>
function myFunction()
{
var x = "Java Enabled: " + navigator.javaEnabled();
document.getElementById("demo").innerHTML=x;
}
</script>
</body>
</html>
当我点击按钮时,结果将显示在同一浏览器中,但我希望它显示在IE
浏览器中。
答案 0 :(得分:0)
如果您只想在IE中显示,请使用conditional comments
<!--[if IE]>
<script>
function myFunction() {
var x = "Java Enabled: " + navigator.javaEnabled();
document.getElementById("demo").innerHTML=x;
}
</script>
<![endif]-->