为什么在ie11下输入字段验证不工作?


input field validation does not work under internet explorer 11 why

无法获得以下代码来对电子邮件进行字段验证,并且根据我的代码只接受某些电子邮件输入。此代码适用于所有接受Internet explorer 11的浏览器,如何采用此代码在i.e. 11下工作,仅接受来自某些电子邮件格式的地址…

在IE 11下-它检查空字段ok,但我不能得到电子邮件模式工作(html5)我怎么能让它在IE 11下工作,它在其他浏览器上工作,好的,提前感谢…singhy

<?php
if(isset($_POST["Subscribe"])){ //name of submit button
    foreach($_POST as $fieldName => $value){
        if($fieldName!="Subscribe"){ //if not submit button
            $fieldValue=$value;
            if($fieldValue == "") {
                echo "Cannot leave ".$fieldName." blank";
                die();
            }
        }
    }
}
?>
<script>
function IsEmpty(){
  if(document.forms['frm'].email.value == "")
  {
    alert("empty field");
    return false;
  }
    return true;
}
</script>
<form name="frm" class="test" method="post" action="myform.php" >
<fieldset><legend><strong>test</strong></legend> 
<p>testing my code...</p>
<p><label for="email">Email address:</label>
<input title="enter email" required="required" name="email" type='email' pattern=".+(@hotmail.com)|.+(@gmail.com)" required />
</p>
 <input id="insert" onclick="return IsEmpty();" style="float: right;" type="submit" name="submit" value="Subscribe" />
</fieldset>
</form>

通过在顶部添加以下代码来对这个问题进行排序

<!DOCTYPE html> 
<html> 
  <head> 
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 

这将把i.e.渲染到边缘,我的所有消息输出和电子邮件验证现在正在工作…再次感谢所有帮助过我的人,多保重!