簡體   English   中英

Netscape Navigator 9中的正則表達式

[英]Regex in Netscape Navigator 9

我在電話號碼字段中有一個正則表達式模式,允許用戶輸入10個數字或0個數字。我已經對其進行了測試,並確認它可以在Google Chrome,Internet Explorer,Firefox,Opera和safari中運行,但由於某些原因,它不能運行在Netscape Navigator 9中工作。非常感謝您的幫助。

謝謝

pattern="^[0-9]{10}$|^[0-9]{0}$"

新趨勢是不檢測特定的瀏覽器,而是支持所需的功能。 在這種情況下為“模式”。

var el = document.createElement('input');
var isPatternSupported = (el.pattern === undefined);

alert(isPatternSupported); // Displays `false` for NN9 and `true` for modern browsers

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM