Loading...

javascript如何通過其 ID 設置選擇元素的選定選項?

Temperature: 0 °C

Mark ChangMark Chang
author_tools

如題,透過javascript來針對某個select的option來做選定。

document.getElementById("要用來設置select的ID").selectedIndex=第幾個option;

或者
document.getElementById("要用來設置select的ID").options.namedItem("第幾個option").selected=true;

或者
document.getElementById("要用來設置select的ID").options[第幾個option].selected=true;

以上紀錄~
 

#故事  #javascript  #select  #option  
https://innstory.com/story-javascript如何通過其_ID_設置選擇元素的選定選項-3144
javascript

Prev
 使用PHP資料量太大遇到Allowed_memory_size_of_134217728_bytes_exhausted_問題

Next
使用PHP取得指定月份最後一天的日期 

About the Author

Mark Chang

離不開電腦的宅男

Visitor message

Leave some footprints to prove that you visited me

Recommended reading

Author's other related stories

要如何修改Plesk空間上傳檔案大小的限制

要如何修改Plesk空間上傳...

Plesk的預設狀況下上傳檔案限制為M。 若要修改上傳限制 首先點選開發工具的PHP設定 innim...

解決svchost.exe消耗記憶體問題

解決svchost.exe消...

pexelsphotowin55 根據微軟中文知識庫編號5的文件說明:「SVCHOST.EXE是從動...

php定時執行任務ignore_user_abort() 函式

php定時執行任務ignor...

ignoreuserabort() 函式 PHP , PHP 5, PHP 最近剛好有一個專案需要定...

Please select an option

error

Hi, thank you for your participation, but you cannot vote repeatedly~

Join innstory now and start recording your story.

"Innstory" is a place to store stories. We are committed to becoming a warm platform. Deepening the bonds between people is our direction.
We are convinced that the blockchain between people is not just a cold calculation. Join us now.

Wrong format