使用selected屬性來指定在HTML頁面加載時應預先選擇該選項。您可以嘗試運行以下代碼來實現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>
登錄后復制
以上就是在HTML中如何指定選項在頁面加載時應預先選中?的詳細內容,更多請關注www.92cms.cn其它相關文章!