js給select下拉框賦值 js如何清除select中的值?
js如何清除select中的值?想法:獲取select tag元素。選擇“選擇”下的選項(xiàng)。替換選項(xiàng)中的內(nèi)容,或刪除選項(xiàng)。代碼:<script>window.onload=函數(shù)(){var oS
js如何清除select中的值?
想法:獲取select tag元素。選擇“選擇”下的選項(xiàng)。替換選項(xiàng)中的內(nèi)容,或刪除選項(xiàng)。代碼:<script>window.onload=函數(shù)(){var oSel=文檔.getElementById(“sel”)var oOpt=新選項(xiàng)(“123”,“abc”)小孩兒(oopt)//添加一個(gè)OptionSel.removeChild選項(xiàng)(oopt)//刪除選項(xiàng)}</script></head><body><select id=“sel”>< option> 1234</選項(xiàng)></選擇>