是不是这个效果啊:<script>
//选择全部
var k=0;function btnForward_onclick(){
var theIndex=window.form1.selSubmit.selectedIndex;;
var FirIndex=theIndex-1;
var lenghtSel=window.form1.selSubmit.length;
if(lenghtSel!=0){
if(theIndex<0){
alert("请您先选择一个要移动的栏目...");
}else{
if(theIndex==0){
alert("已经是最前面了...")
}else{
var valF=window.form1.all("selSubmit")(FirIndex).value; //前一个option的值
var valT=window.form1.all("selSubmit")(theIndex).value; //当前option的值
var innerTextF=window.form1.all("selSubmit")(FirIndex).innerText; //前一个option的显示内容
var innerTextT=window.form1.all("selSubmit")(theIndex).innerText; //当前option的显示内容
window.form1.all("selSubmit")(theIndex).innerText=innerTextF; //改变显示顺序
window.form1.all("selSubmit")(FirIndex).innerText=innerTextT; window.form1.all("selSubmit")(theIndex).value=valF; //改变select的值
window.form1.all("selSubmit")(FirIndex).value=valT; window.form1.selSubmit.selectedIndex=FirIndex
}
}
}else{
alert("没有可前移的视图项目,请新增一个...");
}
}
function btnBackward_onclick(){ var theIndex=window.form1.selSubmit.selectedIndex;
var maxIndex=document.all("selSubmit").length-1;
var lenghtSel=window.form1.selSubmit.length;
var LstIndex=theIndex+1;
if(lenghtSel!=0){
if(theIndex<0){
alert("请您先选择一个要移动的栏目...");
}else{
if(theIndex==maxIndex){
alert("已经是最后面了...")
}else{
var valL=window.form1.all("selSubmit")(LstIndex).value; //后一个option的值
var valT=window.form1.all("selSubmit")(theIndex).value; //当前option的值
var innerTextL=window.form1.all("selSubmit")(LstIndex).innerText; //后一个option的显示内容
var innerTextT=window.form1.all("selSubmit")(theIndex).innerText; //当前option的显示内容
window.form1.all("selSubmit")(LstIndex).innerText=innerTextT; //改变显示顺序
window.form1.all("selSubmit")(theIndex).innerText=innerTextL;
window.form1.all("selSubmit")(LstIndex).value=valT; //改变select的值
window.form1.all("selSubmit")(theIndex).value=valL;
window.form1.selSubmit.selectedIndex=LstIndex
}
}
}else{
alert("没有可后移的视图项目,请新增一个...");
}
}
//选择全部
function addAll(srcSel,objSel) {
var inti
var length1=eval("window.form1."+srcSel+".length")-1;
var tempString
var tempValue
for(inti=0;inti<=length1;inti++){
window.form1.all(srcSel)(inti).selected=true;
var objOpt=document.createElement("option");
tempString=window.form1.all(srcSel)(inti).innerText;
tempValue=window.form1.all(srcSel)(inti).value; objOpt.text=tempString;
objOpt.value=tempValue;
eval("form1."+objSel+".add(objOpt)");
}
for(inti=0;inti<=length1;inti++){ eval("form1."+srcSel+".remove(objOpt)");
}
}//删除全部
function delAll(srcSel,objSel) {
var inti
var length1=eval("window.form1."+objSel+".length")-1;
var tempString
var tempValue
for(inti=0;inti<=length1;inti++){
window.form1.all(objSel)(inti).selected=true;
var objOpt=document.createElement("option"); tempString=window.form1.all(objSel)(inti).innerText;
tempValue=window.form1.all(objSel)(inti).value;
if(objSel!="selSubmit")
{
removeSign(tempString,tempValue); //调用vb子程序进行字符处理
tempString=form1.hid_String1.value; //重新赋值
tempValue=form1.hid_String2.value;
}
objOpt.text=tempString;
objOpt.value=tempValue; eval("form1."+srcSel+".add(objOpt)");
}
for(inti=0;inti<=length1;inti++){
eval("form1."+objSel+".remove(objOpt)");
}
k=0;
}//删除一条记录
function delOne(srcSel,objSel){ var inti
var length1=eval("window.form1."+objSel+".length")-1;
var tempString
var tempValue
inti=eval("window.form1."+objSel+".selectedIndex");
if(length1>=0){
if(inti>=0){ var objOpt=document.createElement("option"); tempString=window.form1.all(objSel)(inti).innerText;
tempValue=window.form1.all(objSel)(inti).value;
if(objSel!="selSubmit")
{
removeSign(tempString,tempValue); //调用vb子程序进行字符处理
tempString=form1.hid_String1.value; //重新赋值
tempValue=form1.hid_String2.value;
}
objOpt.text=tempString;
objOpt.value=tempValue; eval("form1."+srcSel+".add(objOpt)");
eval("form1."+objSel+".remove(inti)");
if(k==5){
k=k-2;
}else{
k=k-1;
}
}else{
alert("请您先选择要移除的栏目...")
}
}else{
alert("没有可移除的栏目...");
}
}//新增一条记录function addOne(srcSel,objSel) { var inti
var length1=eval("window.form1."+srcSel+".length")-1;
var tempString
var tempValue
inti=eval("window.form1."+srcSel+".selectedIndex");
if(length1>=0){
if(inti>=0){
var objOpt=document.createElement("option"); tempString=window.form1.all(srcSel)(inti).innerText;
tempValue=window.form1.all(srcSel)(inti).value;
objOpt.text=tempString;
objOpt.value=tempValue;
eval("form1."+objSel+".add(objOpt)"); //新增一个option
eval("form1."+srcSel+".remove(inti)"); //移除原有的option
}else{
alert("请您先选择要增加的栏目...");
}
}else{
alert("没有可增加的栏目...");
}
}
//新增一条记录
function addOneSort(srcSel,objSel,intj,type) {
k=k+1;
var inti
var length1=eval("window.form1."+srcSel+".length")-1;
var tempString
var tempValue
inti=eval("window.form1."+srcSel+".selectedIndex");
if(length1>=0){
if(inti>=0){
if(k<=intj){
var objOpt=document.createElement("option"); tempString=window.form1.all(srcSel)(inti).innerText;
tempValue=window.form1.all(srcSel)(inti).value; if(type=="down"){
objOpt.text=tempString.replace(/\s+$/,"")+"↓";
objOpt.value=tempValue.replace(/\s+$/,"")+"↓";
}else{
objOpt.text=tempString.replace(/\s+$/,"")+"↑";
objOpt.value=tempValue.replace(/\s+$/,"")+"↑";
}
eval("form1."+objSel+".add(objOpt)");
eval("form1."+srcSel+".remove(inti)");
}else{
alert("对不起,您只能对"+intj+"个栏目进行排序");
}
}else{
alert("请您先选择要排序的栏目...");
k=0;
}
}else{
alert("没有可排序的栏目...");
k=0
}
}</script>(待续)
//选择全部
var k=0;function btnForward_onclick(){
var theIndex=window.form1.selSubmit.selectedIndex;;
var FirIndex=theIndex-1;
var lenghtSel=window.form1.selSubmit.length;
if(lenghtSel!=0){
if(theIndex<0){
alert("请您先选择一个要移动的栏目...");
}else{
if(theIndex==0){
alert("已经是最前面了...")
}else{
var valF=window.form1.all("selSubmit")(FirIndex).value; //前一个option的值
var valT=window.form1.all("selSubmit")(theIndex).value; //当前option的值
var innerTextF=window.form1.all("selSubmit")(FirIndex).innerText; //前一个option的显示内容
var innerTextT=window.form1.all("selSubmit")(theIndex).innerText; //当前option的显示内容
window.form1.all("selSubmit")(theIndex).innerText=innerTextF; //改变显示顺序
window.form1.all("selSubmit")(FirIndex).innerText=innerTextT; window.form1.all("selSubmit")(theIndex).value=valF; //改变select的值
window.form1.all("selSubmit")(FirIndex).value=valT; window.form1.selSubmit.selectedIndex=FirIndex
}
}
}else{
alert("没有可前移的视图项目,请新增一个...");
}
}
function btnBackward_onclick(){ var theIndex=window.form1.selSubmit.selectedIndex;
var maxIndex=document.all("selSubmit").length-1;
var lenghtSel=window.form1.selSubmit.length;
var LstIndex=theIndex+1;
if(lenghtSel!=0){
if(theIndex<0){
alert("请您先选择一个要移动的栏目...");
}else{
if(theIndex==maxIndex){
alert("已经是最后面了...")
}else{
var valL=window.form1.all("selSubmit")(LstIndex).value; //后一个option的值
var valT=window.form1.all("selSubmit")(theIndex).value; //当前option的值
var innerTextL=window.form1.all("selSubmit")(LstIndex).innerText; //后一个option的显示内容
var innerTextT=window.form1.all("selSubmit")(theIndex).innerText; //当前option的显示内容
window.form1.all("selSubmit")(LstIndex).innerText=innerTextT; //改变显示顺序
window.form1.all("selSubmit")(theIndex).innerText=innerTextL;
window.form1.all("selSubmit")(LstIndex).value=valT; //改变select的值
window.form1.all("selSubmit")(theIndex).value=valL;
window.form1.selSubmit.selectedIndex=LstIndex
}
}
}else{
alert("没有可后移的视图项目,请新增一个...");
}
}
//选择全部
function addAll(srcSel,objSel) {
var inti
var length1=eval("window.form1."+srcSel+".length")-1;
var tempString
var tempValue
for(inti=0;inti<=length1;inti++){
window.form1.all(srcSel)(inti).selected=true;
var objOpt=document.createElement("option");
tempString=window.form1.all(srcSel)(inti).innerText;
tempValue=window.form1.all(srcSel)(inti).value; objOpt.text=tempString;
objOpt.value=tempValue;
eval("form1."+objSel+".add(objOpt)");
}
for(inti=0;inti<=length1;inti++){ eval("form1."+srcSel+".remove(objOpt)");
}
}//删除全部
function delAll(srcSel,objSel) {
var inti
var length1=eval("window.form1."+objSel+".length")-1;
var tempString
var tempValue
for(inti=0;inti<=length1;inti++){
window.form1.all(objSel)(inti).selected=true;
var objOpt=document.createElement("option"); tempString=window.form1.all(objSel)(inti).innerText;
tempValue=window.form1.all(objSel)(inti).value;
if(objSel!="selSubmit")
{
removeSign(tempString,tempValue); //调用vb子程序进行字符处理
tempString=form1.hid_String1.value; //重新赋值
tempValue=form1.hid_String2.value;
}
objOpt.text=tempString;
objOpt.value=tempValue; eval("form1."+srcSel+".add(objOpt)");
}
for(inti=0;inti<=length1;inti++){
eval("form1."+objSel+".remove(objOpt)");
}
k=0;
}//删除一条记录
function delOne(srcSel,objSel){ var inti
var length1=eval("window.form1."+objSel+".length")-1;
var tempString
var tempValue
inti=eval("window.form1."+objSel+".selectedIndex");
if(length1>=0){
if(inti>=0){ var objOpt=document.createElement("option"); tempString=window.form1.all(objSel)(inti).innerText;
tempValue=window.form1.all(objSel)(inti).value;
if(objSel!="selSubmit")
{
removeSign(tempString,tempValue); //调用vb子程序进行字符处理
tempString=form1.hid_String1.value; //重新赋值
tempValue=form1.hid_String2.value;
}
objOpt.text=tempString;
objOpt.value=tempValue; eval("form1."+srcSel+".add(objOpt)");
eval("form1."+objSel+".remove(inti)");
if(k==5){
k=k-2;
}else{
k=k-1;
}
}else{
alert("请您先选择要移除的栏目...")
}
}else{
alert("没有可移除的栏目...");
}
}//新增一条记录function addOne(srcSel,objSel) { var inti
var length1=eval("window.form1."+srcSel+".length")-1;
var tempString
var tempValue
inti=eval("window.form1."+srcSel+".selectedIndex");
if(length1>=0){
if(inti>=0){
var objOpt=document.createElement("option"); tempString=window.form1.all(srcSel)(inti).innerText;
tempValue=window.form1.all(srcSel)(inti).value;
objOpt.text=tempString;
objOpt.value=tempValue;
eval("form1."+objSel+".add(objOpt)"); //新增一个option
eval("form1."+srcSel+".remove(inti)"); //移除原有的option
}else{
alert("请您先选择要增加的栏目...");
}
}else{
alert("没有可增加的栏目...");
}
}
//新增一条记录
function addOneSort(srcSel,objSel,intj,type) {
k=k+1;
var inti
var length1=eval("window.form1."+srcSel+".length")-1;
var tempString
var tempValue
inti=eval("window.form1."+srcSel+".selectedIndex");
if(length1>=0){
if(inti>=0){
if(k<=intj){
var objOpt=document.createElement("option"); tempString=window.form1.all(srcSel)(inti).innerText;
tempValue=window.form1.all(srcSel)(inti).value; if(type=="down"){
objOpt.text=tempString.replace(/\s+$/,"")+"↓";
objOpt.value=tempValue.replace(/\s+$/,"")+"↓";
}else{
objOpt.text=tempString.replace(/\s+$/,"")+"↑";
objOpt.value=tempValue.replace(/\s+$/,"")+"↑";
}
eval("form1."+objSel+".add(objOpt)");
eval("form1."+srcSel+".remove(inti)");
}else{
alert("对不起,您只能对"+intj+"个栏目进行排序");
}
}else{
alert("请您先选择要排序的栏目...");
k=0;
}
}else{
alert("没有可排序的栏目...");
k=0
}
}</script>(待续)
解决方案 »
- Struts2+Spring+hibernate集成问题
- (跪求阿)LINUX服务器上,为什么总是会报查询语句出错。我本地运行一点问题都没有?到底是怎么回事呢.
- JS代码分析!
- displayTag分页的问题
- Oracle插入时间日期问题,急,在线等
- 求救,关于 Java 解决 http Post multipart/form-data
- 急问:EXCEL中的单元格的宽度如何设定?
- ?tomcat小问题,请求大家热心的帮助。
- 请教,Applet中能进行数据库操作吗?
- 谁知道哪有最新版本的,tomcat可以下载呀?
- 那位朋友可以给个applet通过servlet取数据库数据的例子?多谢!
- 如何在tomcat启动时初始化application?
request.getParameter("hidVar") ;取到后,再分离。<input type="button" value="test" onclick="test();">
<input type="hidden" name="hidVar"><script>
function test(){
var sTemp = "" ;
var oform = document.form1 ;
for (var i=0;i<oform.selSubmit.length;i++){
sTemp += "*"+oform.selSubmit.options[i].value;
}
oform.hidVar.value = sTemp.substring(1) ;
alert(oform.hidVar.value) ;
}</script>