这不是一个大问题,因为它似乎只是在更改设置和重新加载页面时发生,但它让我烦恼,因为我不明白为什么会发生这种情况。它在firefox上似乎没问题,但是Chrome有问题。
如果我禁用javascript然后刷新页面,它会打印<div class="alert alert-warning alert-dismissible fade in" role=alert>...stuff....</div>
,但如果我第二次刷新页面,它会正确显示它。
关闭按钮有同样的问题,只是它反过来。
这是我的代码:
<head>
<noscript>
<style>
#javascript_close{display:none;}
</style>
</noscript>
</head>
<body>
<noscript>
<div class="alert alert-warning alert-dismissible fade in" role=alert>
<h4>JavaScript is disabled!</h4>
<p>stuff here.</p>
</div>
</noscript>
<div class="alert alert-danger alert-dismissible fade in" role=alert>
<button type=button class=close data-dismiss=alert aria-label=Close id="javascript_close">
<span aria-hidden=true>×</span>
</button>
<h4>Sorry! We found a few problems!</h4>
<p><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span><span class="sr-only">Error:</span> Something is empty.</p>
<p><span class="glyphicon glyphicon-exclamation-sign" aria-hidden="true"></span><span class="sr-only">Error:</span> Something else is invalid.</p>
</div>
</body>
Here's the page如果有人想尝试的话(对源代码道歉,我用PHP生成它所以它缺少换行符)。这不是一个大问题,因为如果你不接触javascript设置似乎工作正常,但现在我知道它有点烦人,所以如果有快速的话修复任何人,我很感激