一旦我在没有 JavaScript 的情况下打开我的网页,我的<noscript>
标签中的表单就会显示为代码,但是在我刷新它之后,它似乎很好。有没有一种方法可以在禁用 JavaScript 后立即正确显示表单,或者有没有一种方法可以在未启用 JavaScript 时立即重新加载页面?
我尝试过使用元刷新,但我想不出一种不使用 JavaScript 只重新加载一次的方法。
这是代码:
<div id="JS" class="span4" style="display: none">
<h2 class="side">contact</h2>
<h3 class="side">message</h3>
<br><br>
<form id="animate" >
<input id="name" name="Name" type="text" value="" placeholder="Your Name" maxlength="25" >
<input id="email" name="Email" type="text" value="" placeholder="Your E-mail" maxlength="100">
<textarea id="Message" name="Message" placeholder="Your Message" spellcheck="true" rows="6"></textarea>
<input id="spam" type="text" name="spam" style="display: none;" value=""/>
<input id="submit" type="submit" name="submit" value="Submit"/>
</form>
<div style="color: black; font-family: urwgroteskregular;" id="thanks">
<h2> Thank you, your message has been received.</h2>
</div>
</div>
<div class="span4" id="noScript">
<noscript>
<h2 class="side">contact</h2>
<h3 class="side">message</h3>
<br><br>
<form action='process.php' method="post" >
<input name="Name" type="text" value="" placeholder="Your Name" required="" maxlength="25">
<input name="Email" type="text" value="" placeholder="Your E-mail" required="" maxlength="100">
<textarea name="Message" placeholder="Your Message" spellcheck="true" rows="6" required=""></textarea>
<input type="text" name="spam" style="display: none;" value=""/>
<input type="submit" name="submit" value="Submit"/>
</form>
</noscript>
<script type="text/javascript">
document.getElementById('JS').style.display = 'block';
document.getElementById('noScript').style.display = 'none';
</script>