function deleteoption() {
for (i=0;i<document.all.select.options.length;i++) {
if (document.all.select.options[i].selected) {
document.all.select.options.remove(i);
}
}
}PS:你写的deleteoption()中的i--,会造成死循环。
for (i=0;i<document.all.select.options.length;i++) {
if (document.all.select.options[i].selected) {
document.all.select.options.remove(i);
}
}
}PS:你写的deleteoption()中的i--,会造成死循环。
解决方案 »
- 郁闷,关于js的offset client scroll等的一些属性,疯了
- 求助,怎么把下面的三级连动改为四级的?
- 请问这Regex怎么写呢
- 怎样将我们的网页做成那种windows的窗口程序啊,像xp中打开我的电脑后的那种窗口效果???
- jquery 更新页面的问题
- 请教一个问题,如何获取网页最大化最小化的事件
- JAVASCRIPT可以在网页中打开文件吗?
- 163邮箱是怎么做到,写新邮件时点击其它链接会弹出对话框,问是否保存?
- 如何使用javascript实现一个在线编辑功能的编辑器??
- 想请教一下,两个层相交重叠的问题。
- 一个简单的字符串替换问题,请进来看看吧
- form里有N个SELECT,在获得了SELECT的总个数以后,怎样取其中的一个?
document.all.select.options.remove(document.all.select.selectedIndex);
}
<body oncontextmenu="//return false;">
<formaction="/servlet/com.beltino.oa.parameter.WorkDay"method="post"name="frame">
请输入列表项
<input name='txt' type='text'>
<INPUT TYPE="button" NAME="button" VALUE="确定" ONCLICK="workday();" onmouseover="this.focus();">
<select name='select' size='8' MULTIPLE style='width: 230px;'>
</select>
<INPUT TYPE="button" NAME="deleteoption" VALUE="删除" ONCLICK="deleteoption();" onmouseover="this.focus();">
</form></body>报的错是 对象不支持属性和方法 就是指上面那代码 我想应该是ONCLICK="deleteoption();" 这个出问题了 但又看不出哪里的问题 晕
function deleteoption() {
for (i=0;i<document.all.myselect.options.length;i++) {
if (document.all.myselect.options[i].selected) {
document.all.myselect.options.remove(i);
}
}
}
晕 我也改成你那样的 你试试我这网页 文本框中的值等传到SELECT中去 但我选中SELECT中的值,却还是和以前一样的错误 对象不支持属性或方法!!!!郁闷中!!!! 求救!!1
你的按钮名字和函数名字重复了。