表單若要不允許輸入,一般用 disabled 或 display:none。但這樣頁面外觀往往毫無變化。如果你希望滑鼠移上去時能變成紅色的禁止(警告)游標,就可以加上以下屬性:
style="cursor: not-allowed" disabled
完整示例程式碼如下:
<input type="text" style="cursor:not-allowed" disabled />
透過 cursor: not-allowed,當使用者把滑鼠移到這個已停用的輸入框上時,游標就會變成一個帶有禁止符號的樣式,清楚地傳達「此處不可輸入」的訊息。