| 
			 
					阅读:8616回复:11
				 
				这段Javascript为什么有错误?
					Error:lselect1.options.remove is not a function
 
							Source File: *** Line: 42 难道在FireFox没有remove这个函数?  | 
	|
| 
			 1楼# 
								发布于:2005-07-06 15:21				
			
					mozilla web developer
 
							http://www.mozilla.org/docs/web-developer/ <select> <option value="aaa">123</option> <option value="bbb">456</option> </select> <button onclick="myOption=document.getElementsByTagName('select')[0];myOption.options[myOption.options.length]=new Option('guoshuangText','guoshuangValue')">add option</button>  | 
	|
| 
			 2楼# 
								发布于:2005-07-06 15:21				
			
					那如果是增加呢?
 
							function mydelete() { var sel = document.getElementById("sel"); sel.options.add(sel.selectedIndex); } 在Firefox里面又应该怎么处理  | 
	|
| 
			 3楼# 
								发布于:2005-07-06 15:21				
			 | 
	|
| 
			 4楼# 
								发布于:2005-07-06 15:21				
			 | 
	|
| 
			 5楼# 
								发布于:2005-07-06 15:21				
			
					TO guoshuang:
 
							W3C有javascript的资料吗?我好像没有找到  | 
	|
| 
			 6楼# 
								发布于:2005-07-06 15:21				
			
					在 develop.netscape 重新开通之前,只能去 w3c 找资料				 
							 | 
	|
| 
			 7楼# 
								发布于:2005-07-06 15:21				
			
					TO jhsea3do:
 
							不好意思,我没有说清楚。问题现在已经解决了,还是谢谢你! 我把代码整理后,如下: <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>New Page1</title> <script language=javascript> function mydelete() { var sel = document.getElementById("sel"); sel.options.remove(sel.selectedIndex); } </script> </head> <body> <select id="sel" style="width:100px;height:150px" multiple=true> <option value="1">11111</option> <option value="2">22222</option> <option value="3">33333</option> <option value="4">44444</option> <option value="5">55555</option> </select> <input id=btn type=button value="delete" onclick="mydelete()"> </body> </html> 在IE中,这是可以正确运行的,但是在FireFox中,这是不能运行的。需要把sel.options.remove(sel.selectedIndex);改成:sel.remove(sel.selectedIndex); 不过,我有个疑问:为什么没有相关的文档可以参考,难道我们只能摸索着写code?  | 
	|
| 
			 8楼# 
								发布于:2005-07-06 15:21				
			
					找到方法了,原来在FireFox里面,没有list1.options.remove,只能list1.remove,不过为什么没有相关的文档?我还是在MSDN里面找到替代的方法的				 
							 | 
	|
| 
			 9楼# 
								发布于:2005-07-06 15:21				
			
					https://www.firefox.net.cn/newforum/viewtopic.php?t=2284
 
							看不懂你想表达什么意思,html代码不贴上来人家怎么帮你? var list1=document.getElementById("lbxLocation1"); 没看过这样取list对象的  | 
	|
					
						
  | 
	
| 
			 10楼# 
								发布于:2005-07-06 15:21				
			
					没有人知道吗?
 
							还有,顺便问一下,FireFox所支持的Javascript,有没有相关的说明文档?就像MSDN那样的文档 谢谢!  | 
	|
| 
			 11楼# 
								发布于:2005-07-06 15:21				
			
					部分代码:
 
							var list1=document.getElementById("lbxLocation1"); list1.options.remove(list1.selectedIndex);  | 
	|