使用selected屬性來指定在HTML頁面加載時應(yīng)預(yù)先選擇該選項。您可以嘗試運行以下代碼來實現(xiàn)selected屬性 ?
示例
<!DOCTYPE html> <html> <head> <title>HTML selected attribute</title> </head> <body> <p>Here's the list of subjects. Select any one:</p> <form> <select name = "dropdown"> <option value = "Computer Architecture" selected>Computer Architecture</option> <option value = "Java">Java</option> <option value = "Discrete Mathematics">Discrete Mathematics</option> </select> </form> </body> </html>
登錄后復(fù)制
以上就是在HTML中如何指定選項在頁面加載時應(yīng)預(yù)先選中?的詳細內(nèi)容,更多請關(guān)注www.92cms.cn其它相關(guān)文章!