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

WBOY
Release: 2016-05-16 17:13:14
Original
1257 people have browsed it
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);
}
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template