根据定义<noscript>
如果禁用 Javascript,则应显示其中的文本。
我使用 IE11 并禁用 JavaScript,只看到一个空白页面,根本没有任何消息。
<head>
<noscript>Javascript is disabled!</noscript>
<script>document.getElementById("demo").innerHTML="Script Enabled";</script>
</head>
<p id="demo"> Test</p>
我错过了什么吗?
最佳答案
根据您上面告诉我们的内容,您似乎输入/使用了正确的语法。
我在 Chrome 47 中尝试过,工作正常,也许在不同的浏览器中尝试一下,看看你的结果,或者确保你实际上已经关闭了 JavaScript。
示例:
<script>
document.write("Hello World!")
</script>
<noscript>Your browser does not support JavaScript!</noscript>
来自 W3Schools - here
你也可以这样做:
$(document).ready(function() {
$('#noscript-description').css({
'display' : 'none'
// Just change the none to block to see the results
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<html>
<body>
<p id="noscript-description">This can be seen if you <b>DO NOT</b> have JavaScript enabled.</p>
<!-- I have added in jQuery, if you never realised -->
</body>
</html>
关于HTML <noscript> 标签不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34231292/