<select id=S></select>
<script>
function Add()
{
document.all.S.length=10;
var iCount=document.all.S.length;
for(iIndex=0;iIndex<iCount;iIndex++)
{
document.all.S.options[iIndex].value=iIndex+"值";
document.all.S.options[iIndex].text=iIndex+"项";
}
}
function Clear()
{
document.all.S.length=0;
}
</script>
<script>
function Add()
{
document.all.S.length=10;
var iCount=document.all.S.length;
for(iIndex=0;iIndex<iCount;iIndex++)
{
document.all.S.options[iIndex].value=iIndex+"值";
document.all.S.options[iIndex].text=iIndex+"项";
}
}
function Clear()
{
document.all.S.length=0;
}
</script>
<select name="obj"></select>
<input type="button" onclick="javascript:itemDelete(document.test.obj);">
</form>
//delete
function itemDelete(obj){
var lengthObj = obj.length;
for(i = 0;i < lengthObj;i++){
if(obj.options[i].selected){
obj.remove(i);
lengthObj = obj.length;
i--;
}
}
}
var obj = document.myForm.aa;
var opts= obj.options;
var index = 1;
opts[index] = null;
}
function addOption(){
var obj = document.myForm.aa;
var opts= obj.options;
var opt = new Option("五","五");
opts.length++;
opts[opts.length-1] = opt;
}