站长资源网页制作

清空select标签中option选项的3种不同方式

整理:jimmy2024/7/3浏览2
简介方法一 复制代码代码如下: document.getElementById("selectid").options.length = 0; 方法二 复制代码代码如下: document.formName.selectName.options.length = 0; 方法三 复制代码代码如下: doc
方法一

复制代码代码如下:
document.getElementById("selectid").options.length = 0;

方法二

复制代码代码如下:
document.formName.selectName.options.length = 0;

方法三

复制代码代码如下:
document.getElementById("selectid").innerHTML = "";