有時項目需要禁止用戶輸入中文、符號等,減少用戶輸入出錯誤的可能性,css屬性有這樣的功能。
ime-mode的語法解釋如下:
ime-mode : auto | active | inactive | disabled
取值:
auto : 默認值。不影響IME(Input Method Editors 輸入法編輯器)的狀態。與不指定 ime-mode 屬性時相同
active : 指定所有使用IME輸入的字符。即激活本地語言輸入法。用戶仍可以撤銷激活IME
inactive : 指定所有不使用IME輸入的字符。即激活非本地語言。用戶仍可以撤銷激活IME
disabled : 完全禁用IME。對于有焦點的控件(如輸入框),用戶不可以激活IME
于是
在全局樣式中定義如下:
.ime-disabled{ime-mode:disabled;}/* 屏蔽輸入法 */
頁面級定義如下:
<input type="text" name="mobile" class="ime-disabled" >
ASP.NET中直接引用
<asp:TextBox ID="txtRuling_No" runat="server" Width="80px" MaxLength="8" CssClass="txt" style="ime-mode:disabled "></asp:TextBox>
|
新聞熱點
疑難解答