清空select标签中option选项的3种不同方式
来源:动视网
责编:小采
时间:2020-11-27 14:45:06
清空select标签中option选项的3种不同方式
清空select标签中option选项的3种不同方式:方法一 代码如下: document.getElementById(selectid).options.length = 0; 方法二 代码如下: document.formName.selectName.options.length = 0; 方法三 代码如下: document.getElementById(selectid).in
导读清空select标签中option选项的3种不同方式:方法一 代码如下: document.getElementById(selectid).options.length = 0; 方法二 代码如下: document.formName.selectName.options.length = 0; 方法三 代码如下: document.getElementById(selectid).in

方法一
代码如下:
document.getElementById("selectid").options.length = 0;
方法二
代码如下:
document.formName.selectName.options.length = 0;
方法三
代码如下:
document.getElementById("selectid").innerHTML = "";
清空select标签中option选项的3种不同方式
清空select标签中option选项的3种不同方式:方法一 代码如下: document.getElementById(selectid).options.length = 0; 方法二 代码如下: document.formName.selectName.options.length = 0; 方法三 代码如下: document.getElementById(selectid).in