Home >Web Front-end >JS Tutorial >Summary of various methods for deleting option options in javascript_javascript skills

Summary of various methods for deleting option options in javascript_javascript skills

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOriginal
2016-05-16 17:13:141317browse
1. JavaScript
Copy code The code is as follows:

var oSel= document.form1.DropDownCity;
while(oSel.options.length>0){
oSel.removeChild(oSel.options[0]);
}

2. JavaScript
Copy code The code is as follows:



3. JavaScript
Copy code The code is as follows:



4. JavaScript
Copy code The code is as follows:



removeOption Usage in IE
Copy code The code is as follows:

function removeOption(index)
{
document.getElementById("selUnassignedUsers").options.remove(index);
}

removeOption Usage in FF
Copy code The code is as follows:

function removeOption(index)
{
document.getElementById("selUnassignedUsers") .remove(index);
}
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn