<form name=f>
<input name=a type=file>
<input onclick="aa()" value="add" type=button>
<input onclick="aaa()" value="delete" type=button><br>
<select multiple size=10 name=s></select>
<form>
<script>
function aa()
{
ss=false
if(document.f.s.options.length==0)
{
document.f.s.options[document.f.s.options.length]=new Option(document.f.a.value,document.f.a.value)
return
}
for(j=0;j<document.f.s.options.length;j++)
{
if(document.f.s.options[j].value==document.f.a.value)
ss=true
}
if(!ss) document.f.s.options[document.f.s.options.length]=new Option(document.f.a.value,document.f.a.value)
}
function aaa()
{
for(i=document.f.s.options.length-1;i>-1;i--)
{if(document.f.s.options[i].selected) document.f.s.removeChild(document.f.s.options[i])
}
}
</script>
<input name=a type=file>
<input onclick="aa()" value="add" type=button>
<input onclick="aaa()" value="delete" type=button><br>
<select multiple size=10 name=s></select>
<form>
<script>
function aa()
{
ss=false
if(document.f.s.options.length==0)
{
document.f.s.options[document.f.s.options.length]=new Option(document.f.a.value,document.f.a.value)
return
}
for(j=0;j<document.f.s.options.length;j++)
{
if(document.f.s.options[j].value==document.f.a.value)
ss=true
}
if(!ss) document.f.s.options[document.f.s.options.length]=new Option(document.f.a.value,document.f.a.value)
}
function aaa()
{
for(i=document.f.s.options.length-1;i>-1;i--)
{if(document.f.s.options[i].selected) document.f.s.removeChild(document.f.s.options[i])
}
}
</script>
<input name=a type=file>
<input onclick="aa()" value="add" type=button>
<input onclick="aaa()" value="delete" type=button><br>
<select multiple size=10 name=s></select>
<form>
<script>
function aa()
{
ss=false
o=document.f
if(o.s.options.length==0)
{
o.s.options[o.s.options.length]=new Option(o.a.value,o.a.value)
return
}
for(j=0;j<o.s.options.length;j++)
{
if(o.s.options[j].value==o.a.value)
ss=true
}
if(!ss) o.s.options[o.s.options.length]=new Option(o.a.value,o.a.value)
}
function aaa()
{
o=document.f
for(i=o.s.options.length-1;i>-1;i--)
{
if(o.s.options[i].selected) o.s.removeChild(o.s.options[i])
}
}
</script>
你发的第一个回复好用,浏览和ADD的按钮可以合并为一个吗?
那个file隐藏起来,直接点击ADD,就可以弹出一个本地目录,选择文件后进入多行选择列表里。
两段程序都有些小问题呀
就是在删除一列或多列后,
列表里的每行会多几个或少几个字符,很奇怪的。
<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<form name=f>
<input type=file id=a style="display: none" onPropertyChange="aa()">
<input type=button value="add" onclick="a.click()">
<input onclick="aaa()" value="delete" type=button><br>
<select multiple size=10 name=s></select>
<form>
<script>
function aa()
{
ss=false
o=document.f
if(o.s.options.length==0)
{
o.s.options[o.s.options.length]=new Option(o.a.value,o.a.value)
return
}
for(j=0;j<o.s.options.length;j++)
{
if(o.s.options[j].value==o.a.value)
ss=true
}
if(!ss) o.s.options[o.s.options.length]=new Option(o.a.value,o.a.value)
}function aaa()
{
o=document.f
for(i=o.s.options.length-1;i>-1;i--)
{
if(o.s.options[i].selected) o.s.removeChild(o.s.options[i])
}
}
</script>
</body>
</html>