樣式無 “readonly” 屬性元素使用 CSS
使用 CSS 中的 read-write 選擇器來選擇未設定“readonly”屬性的元素。
示例
你可以嘗試執行以下程式碼來實現:read-write 選擇器
<!DOCTYPE html> <html> <head> <style> input:read-write { background-color: blue; color: white; } </style> </head> <body> <form> Subject: <input type = "text" name = "subject" value = "Java"><br> Student: <input type = "text" name = "student" readonly value = "Amit"><br> </form> </body> </html>
廣告