Form元件Disabled後,還能夠控制內容的顏色嗎?

請問各位web程式高手們一個笨問題,

Form元件(如:input box)被disabled後,它所顯示的內容顏色會變成淺灰色,

有沒有辦法利用css或是其他的方式,控制內容的顏色ㄋ?

謝謝...

Update:

親愛的QQQ:

我試過您的方式,但後來發現,您在input標籤裡下的是disable,正確的應該是disabled。如果是disabled的話,使用您提供的CSS語法一樣沒辦法控制顏色。

2 Answers

Rating
  • Anonymous
    1 decade ago
    Best Answer

    用readonly

    radiobutton 用JS 直接return false

    Source(s): 自己
  • Anonymous
    1 decade ago

    Form元件Disabled後,還能夠控制內容的顏色嗎?

    可以啊 !

    例如以下的CSS

    border:none /*將input box 邊框去掉 */

    color:red /*將input box 邊框內文字設為紅色 */

    ================================================================

    <html>

    <head>

    <title>Form元件Disabled後,還能夠控制內容的顏色嗎?</title>

    <style>

    input {border:none;color:red}

    </style>

    </head>

    <body>

    <input disable value=dasdasdasdasd>

    </body>

    </html>

    ================================================================

    Oops !

    看來是沒辦法改了 !

    Per Microsoft :

    " When an element is disabled, it appears dimmed and does not respond to user input. Disabled elements do not respond to mouse events, nor will they respond to the contentEditable property. "

    Sorry !

Still have questions? Get your answers by asking now.