请问有没有最简单的方法实现两个列表的内容相互移动.
列表1 | 列表2 |
[内容] | [列表1的内容] |
[此贴子已经被作者于2007-9-8 11:42:00编辑过]
这个是第一页的代码
[CODE]<!--#include file="conn.asp"-->
<%dim did,dname
did=request.querystring("downid")
dname=request.querystring("proname")
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
.box{ margin:10px auto auto 10px;border:solid 1px #006699;width:98%;}
.topbg{margin:1px 1px auto 1px; background:#006699;height:30px;width:auto;}
.config{margin:5px 5px auto 5px;width:auto;}
.input{border:solid 1px #d2d2d2;width:200px;height:25px;}
.button{border:solid 1px #d2d2d2;width:30px;height:25px;}
.input1{border:solid 1px #d2d2d2;width:500px;height:25px;}
.pictable{height:30px;width:600px;}
.font{color:#ffffff;font-size:"18px";text-align:center;}
.title{font-color:"#000000"; font-size:16px; font-family:宋体,Arial, Helvetica, sans-serif;background:#f1fafa;}
.table{background:#006699;}
.contents{font-color:"#000000"; font-size:12px; font-family:宋体,Arial, Helvetica, sans-serif;}
a{ text-decoration: none; color:#006699;}
a:hover{
display:block;
width:auto;
height:auto;
background-color: #d2d2d2;
}
-->
</style>
</head>
<script type="text/javascript">
<!--
function Mv(a,b){
var i=0;
var f=document.getElementById(a);
var t=document.getElementById(b);
for (var i=0; i<f.options.length;i++){
if(f.options[i].selected){
var no=new Option();
no.value=f.options[i].value;
no.text=f.options[i].text;
t.options[t.options.length]=no;}
}
Rv(a);
}
function Rv(o){
var o=document.getElementById(o);
for(var i=o.options.length-1;i>=0;i--){
if (o.options[i].selected && o.options[i] !=""){
o.options[i].value="";
o.options[i].text="";
o.options[i]=null;
}
}
}
-->
</script>
<body>
<div class="box">
<div class="topbg">
<div class="font">增加下载</div>
</div>
<div class="config">
<%dim rs1
set rs1=server.createobject("adodb.recordset")
rs1.open "select * from download where downid="&did,dbconn,1,1%>
<form name="myform" method="post" action="downloadsave.asp?action=newdown" >
<table width="99%" border="0" cellpadding="1" cellspacing="1" class="table">
<tr class="title">
<td class="contents">Product Name</td>
<td><input name="proname" type="text" class="input" value="<%=rs1("proname")%>"/></td>
<td>Downtype</td>
<td><select class="input" name="downtypeid">
<%dim rs2
set rs2=server.createobject("adodb.recordset")
rs2.open"select * from download_class order by downtypeid ASC",dbconn,1,1
do while not rs2.eof%>
<option selected value="<%=rs2("downtypeid")%>"><%=rs2("downtypename")%></option>
<%rs2.movenext
loop
rs2.close
set rs2=nothing%>
</select></td>
</tr>
<tr bgcolor="#f1fafa">
<td class="contents" >File Version </td>
<td ><input name="fversion" type="text" class="input" /></td>
<td >Filesize</td>
<td ><input name="fsize" type="text" class="input" /></td>
</tr>
<tr bgcolor="#f1fafa">
<td class="contents">Operation System </td>
<td colspan="3" ><table border="0" cellpadding="0" cellspacing="0"><tr><td><select name="sel1" size="8" multiple="true">
<option value="DOS">DOS</option>
<option value="Windows95/98">Windows95/98</option>
<option value="Windows2000">Windows2000</option>
<option value="Windows XP">Windows XP</option>
<option value="Windows XP 64Bit">Windows XP 64Bit</option>
<option value="Windows Server2003 32Bit">Windows Server2003 32Bit</option>
<option value="Windows Server2003 64Bit">Windows Server2003 64Bit</option>
<option value="Windows Vista x86 32Bit">Windows Vista x86 32Bit</option>
<option value="Windows Vista x64 64Bit">Windows Vista x64 64Bit</option>
<option value="Linux">Linux</option>
</select></td><td>
<input name=" " type="button" class="button" onClick="Mv('sel1','sel2');" value="→" />
<br/>
<input name=" " type="button" class="button" onClick="Mv('sel2','sel1');" value="←" /></td>
<td>
<select name="sel2" size="8" multiple="true">
</select> </td></tr></table></td>
</tr>
<tr bgcolor="#f1fafa">
<td class="contents">Global</td>
<td colspan="3" ><input name="global1" type="text" class="input1"/></td>
</tr>
<tr bgcolor="#f1fafa">
<td class="contents">USA1</td>
<td colspan="3" ><input name="usa1" type="text" class="input1" /></td>
</tr>
<tr bgcolor="#f1fafa">
<td class="contents">USA2</td>
<td colspan="3" ><input name="usa2" type="text" class="input1" /></td>
</tr>
<tr bgcolor="#f1fafa">
<td class="contents">Europe</td>
<td colspan="3" ><input name="europe1" type="text" class="input1" /></td>
</tr>
<tr bgcolor="#f1fafa">
<td class="contents">China</td>
<td colspan="3" ><input name="china1" type="text" class="input1" /></td>
</tr>
<tr bgcolor="#f1fafa">
<td class="contents">TW</td>
<td colspan="3" ><input name="tw" type="text" class="input1" /></td>
</tr>
<tr bgcolor="#f1fafa">
<td class="contents">Other1</td>
<td colspan="3" ><input name="other1" type="text" class="input1" /></td>
</tr>
<tr bgcolor="#f1fafa">
<td class="contents">Other2</td>
<td colspan="3" ><input name="other2" type="text" class="input1" /></td>
</tr>
<tr bgcolor="#f1fafa">
<td class="contents">Description</td>
<td colspan="3" ><textarea name="description1" style="display:none;"></textarea>
<iframe id="description1" src="jweditor/ewebeditor.asp?id=description1&style=mimi" frameborder="0" scrolling="no" width="600px" height="200px"></iframe></td>
</tr>
<tr class="contents" bgcolor="#f1fafa">
<td></td>
<td colspan="3" ><input name="Submit" type="submit" class="button" value="确定" />
<input name="Submit2" type="reset" class="button" value="重写" /></td>
</tr>
</table>
</form>
<%rs2.close
set rs2=nothing%>
</div>
</div>
</body>
</html>
[/CODE]
这个是第一页的代码
[CODE]<!--#include file="conn.asp"-->
<%dim did,dname
did=request.querystring("downid")
dname=request.querystring("proname")
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
.box{ margin:10px auto auto 10px;border:solid 1px #006699;width:98%;}
.topbg{margin:1px 1px auto 1px; background:#006699;height:30px;width:auto;}
.config{margin:5px 5px auto 5px;width:auto;}
.input{border:solid 1px #d2d2d2;width:200px;height:25px;}
.button{border:solid 1px #d2d2d2;width:30px;height:25px;}
.input1{border:solid 1px #d2d2d2;width:500px;height:25px;}
.pictable{height:30px;width:600px;}
.font{color:#ffffff;font-size:"18px";text-align:center;}
.title{font-color:"#000000"; font-size:16px; font-family:宋体,Arial, Helvetica, sans-serif;background:#f1fafa;}
.table{background:#006699;}
.contents{font-color:"#000000"; font-size:12px; font-family:宋体,Arial, Helvetica, sans-serif;}
a{ text-decoration: none; color:#006699;}
a:hover{
display:block;
width:auto;
height:auto;
background-color: #d2d2d2;
}
-->
</style>
</head>
<script type="text/javascript">
<!--
function Mv(a,b){
var i=0;
var f=document.getElementById(a);
var t=document.getElementById(b);
for (var i=0; i<f.options.length;i++){
if(f.options[i].selected){
var no=new Option();
no.value=f.options[i].value;
no.text=f.options[i].text;
t.options[t.options.length]=no;}
}
Rv(a);
}
function Rv(o){
var o=document.getElementById(o);
for(var i=o.options.length-1;i>=0;i--){
if (o.options[i].selected && o.options[i] !=""){
o.options[i].value="";
o.options[i].text="";
o.options[i]=null;
}
}
}
function Page_Submit()
{
var sel=document.myform.sel2;
for(var i=0;i<sel.options.length;i++)
{
document.myform.sel3.value+=sel2.options[i].value+"|";
}
}
-->
</script>
<body>
<div class="box">
<div class="topbg">
<div class="font">增加下载</div>
</div>
<div class="config">
<%dim rs1
set rs1=server.createobject("adodb.recordset")
rs1.open "select * from download where downid="&did,dbconn,1,1%>
<form name="myform" method="post" action="downloadsave.asp?action=newdown" >
<table width="99%" border="0" cellpadding="1" cellspacing="1" class="table">
<tr class="title">
<td class="contents">Product Name</td>
<td><input name="proname" type="text" class="input" value="<%=rs1("proname")%>"/></td>
<td>Downtype</td>
<td><select class="input" name="downtypeid">
<%dim rs2
set rs2=server.createobject("adodb.recordset")
rs2.open"select * from download_class order by downtypeid ASC",dbconn,1,1
do while not rs2.eof%>
<option selected value="<%=rs2("downtypeid")%>"><%=rs2("downtypename")%></option>
<%rs2.movenext
loop
rs2.close
set rs2=nothing%>
</select></td>
</tr>
<tr bgcolor="#f1fafa">
<td class="contents" >File Version </td>
<td ><input name="fversion" type="text" class="input" /></td>
<td >Filesize</td>
<td ><input name="fsize" type="text" class="input" /></td>
</tr>
<tr bgcolor="#f1fafa">
<td class="contents">Operation System </td>
<td colspan="3" ><table border="0" cellpadding="0" cellspacing="0"><tr><td><select name="sel1" size="8" multiple="true">
<option value="DOS">DOS</option>
<option value="Windows95/98">Windows95/98</option>
<option value="Windows2000">Windows2000</option>
<option value="Windows XP">Windows XP</option>
<option value="Windows XP 64Bit">Windows XP 64Bit</option>
<option value="Windows Server2003 32Bit">Windows Server2003 32Bit</option>
<option value="Windows Server2003 64Bit">Windows Server2003 64Bit</option>
<option value="Windows Vista x86 32Bit">Windows Vista x86 32Bit</option>
<option value="Windows Vista x64 64Bit">Windows Vista x64 64Bit</option>
<option value="Linux">Linux</option>
</select></td><td>
<input name=" " type="button" class="button" onClick="Mv('sel1','sel2');" value="→" />
<br/>
<input name=" " type="button" class="button" onClick="Mv('sel2','sel1');" value="←" /></td>
<td>
<select name="sel2" size="8" multiple="true">
</select> </td></tr></table></td>
</tr>
<tr bgcolor="#f1fafa">
<td class="contents">Global</td>
<td colspan="3" ><input name="global1" type="text" class="input1"/></td>
</tr>
<tr bgcolor="#f1fafa">
<td class="contents">USA1</td>
<td colspan="3" ><input name="usa1" type="text" class="input1" /></td>
</tr>
<tr bgcolor="#f1fafa">
<td class="contents">USA2</td>
<td colspan="3" ><input name="usa2" type="text" class="input1" /></td>
</tr>
<tr bgcolor="#f1fafa">
<td class="contents">Europe</td>
<td colspan="3" ><input name="europe1" type="text" class="input1" /></td>
</tr>
<tr bgcolor="#f1fafa">
<td class="contents">China</td>
<td colspan="3" ><input name="china1" type="text" class="input1" /></td>
</tr>
<tr bgcolor="#f1fafa">
<td class="contents">TW</td>
<td colspan="3" ><input name="tw" type="text" class="input1" /></td>
</tr>
<tr bgcolor="#f1fafa">
<td class="contents">Other1</td>
<td colspan="3" ><input name="other1" type="text" class="input1" /></td>
</tr>
<tr bgcolor="#f1fafa">
<td class="contents">Other2</td>
<td colspan="3" ><input name="other2" type="text" class="input1" /></td>
</tr>
<tr bgcolor="#f1fafa">
<td class="contents">Description</td>
<td colspan="3" ><textarea name="description1" style="display:none;"></textarea>
<iframe id="description1" src="jweditor/ewebeditor.asp?id=description1&style=mimi" frameborder="0" scrolling="no" width="600px" height="200px"></iframe></td>
</tr>
<tr class="contents" bgcolor="#f1fafa">
<td></td>
<td colspan="3" ><input name="Submit" type="button" onClick="Page_Submit();" class="button" value="确定" />
<input name="Submit2" type="reset" class="button" value="重写" /></td>
</tr>
</table>
<input type="hidden" name="sel3" >
</form>
<%rs2.close
set rs2=nothing%>
</div>
</div>
</body>
</html>
[/CODE]
sub newdown()
set rs3=server.createobject("adodb.recordset")
rs3.open "select * from download where downid is null",dbconn,1,3
rs3.addnew
rs3("proname")=request.form("proname")
rs3("downtypeid")=request.form("downtypeid")
rs3("fversion")=request.form("fversion")
rs3("fsize")=request.form("fsize")
rs3("os")=Mid(request.form("sel2"),1,len(request.form("sel2"))-1)
rs3("global")=request.form("global1")
rs3("usa1")=request.form("usa1")
rs3("usa2")=request.form("usa2")
rs3("europe")=request.form("europe1")
rs3("china")=request.form("china")
rs3("tw")=request.form("tw")
rs3("other1")=request.form("other1")
rs3("other2")=request.form("other2")
rs3("fdescription")=request.form("description1")
rs3("uptime")=now()
rs3.update
rs3.close
set rs3=nothing
response.write"<script>alert('增加成功');window.location.href='downloadlist.asp';</script>"
response.End()
end sub
如果是所有列表的值写入数据库可以这样写。