2015-09-13 23 views
0

有些事情困擾了我幾天了,我怎麼能在Internet Explorer 11中標準化輸入驗證消息和下面的代碼工作正常,並且在Chrome,Firefox等下的消息是好的。空白輸入字段消息不同根據互聯網瀏覽器v11

我有一個電子郵件領域,我檢查它,以確保電子郵件是在一個特定的方式模式匹配這工作正常,我有一個提交按鈕與該字段。如果此電子郵件字段爲空,則應在Chrome,Firefox中顯示一條消息「請填寫字段」,但當我在IE v11下嘗試使用此標準消息時,該如何強制此消息在IE V11中相同..

<form method="post" action="web url to a page"> 
 
    <p> 
 
     <label for="email">Email</label> 
 
     <input title="(Please enter your email address.)" required="required" name="email" type='email' pattern=".+(@hotmail.com)|.+(@gmail.co.uk)" required /> 
 
    </p> 
 
    <input style="float: right;" type="submit" name="submit" value="Subscribe" /> 
 
</form>

+1

它有什麼不同? – PeeHaa

+0

嗨有peehaa我得到「這是一個必填字段」在Internet Explorer 11下,在Chrome和Firefox下,我收到了同樣的消息「請填寫此字段」和我的代碼中的消息在圓括號中(請輸入您的電子郵件地址),如果電子郵件字段中沒有任何內容,並且您將其提交爲空白,但是我想在Internet Explorer 11中將此消息標準化,是否有可能!! ..提前致謝... singhy – user3723480

+0

標題與錯誤消息相關的屬性? – PeeHaa

回答

0

首先感謝所有幫助我得到了,下面是我用來排序的問題,我曾與IE 11日消息輸出,見below..thanks singhy

代碼

function IsEmpty(){ 
 
    if(document.forms['frm'].question.value == "") 
 
    { 
 
    alert("empty"); 
 
    return false; 
 
    } 
 
    return true; 
 
} 
 

 

 
<form name="frm"> 
 
    Question: <input name="question"/> <br /> 
 
    <input id="insert" onclick="return IsEmpty();" type="submit" value="Add Question"/> 
 
</form>