简体   繁体   English

Webshims lib:HTML5 Web表单验证在IE8中不起作用

[英]Webshims lib: HTML5 web form validation not working in IE8

I'm new to HTML5 forms and getting them to work in older browsers. 我是HTML5表单的新手,让他们在旧版浏览器中工作。 I am trying to get my simple HTML5 demo form to validate in IE8 using the Webshims Lib polyfill, but it does not seem to validate. 我正在尝试使用Webshims Lib polyfill在IE8中验证我的简单HTML5演示表单,但它似乎没有验证。 As far a I can tell, I've followed the directions from the Webshims Lib website . 据我所知,我遵循了Webshims Lib网站的指示。 What am I doing wrong? 我究竟做错了什么? Here's my code (below) and live link 这是我的代码(下面)和实时链接

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Untitled Document</title>
<script src="http://code.jquery.com/jquery-1.9.1.min.js"></script>
<script src="js/modernizr-custom.js"></script>
<script src="js/polyfiller.js"></script>

<style>
ul {list-style-type: none; margin-top: 100px;}
li {padding-bottom: 10px;}
</style>
</head>

<body>
<form id="myform" action="process.php" method="post">

<ul>
<li><label>Name</label>
<input type="text" name="name"></li>

<li><label>Email</label>
<input type="email" name="email" required></li>

<li><label>Numbers</label>
<input type="number" name="numbers"></li>

<li><label>Message</label>
<textarea name="message" placeholder="Type Here" required></textarea></li>

<li><input id="submit" name="submit" type="submit" value="Submit"></li>
</ul>

</form>

<script>
$.webshims.polyfill();
</script>

</body>
</html>

You have to copy the whole js-webshim folder into your project. 您必须将整个js-webshim文件夹复制到项目中。 Currently you only have included polyfiller.js. 目前您只包括polyfiller.js。 This script only handles the polyfills and includes them from the shim folder. 此脚本仅处理polyfill并从shim文件夹中包含它们。

If you open up your developer console, you will see that you have a lot of 404 requests for js/shims...js. 如果你打开你的开发者控制台,你会发现你有很多404请求js / shims ... js。

Some notes as long as you are using only form you should use webshims.polyfill('forms') or webshims.polyfill('forms forms-ext') and not webshims.polyfill(). 只要您使用的是表格,您应该使用webshims.polyfill('forms')或webshims.polyfill('forms forms-ext')而不是webshims.polyfill()。 If you have still problems, you should use the files from the dev folder and open your console. 如果仍有问题,则应使用dev文件夹中的文件并打开控制台。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM