请求帮助:这样一个页面的脚本代码

visual_alan 2005-09-06 05:10:15
问题1:aaaaaaaa 问题1
问题2:bbbbbbbb -> 问题2
问题3:cccccccc 问题3
问题4:dddddddd <- 问题4

就是将左边的选中,点击->放到右边,同时左边不再显示。
...全文
104 6 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
visual_alan 2005-09-08
  • 打赏
  • 举报
回复
可以了,想换个方式来做。请看:
http://community.csdn.net/Expert/topic/4256/4256470.xml?temp=.8794824

可否给我发些js的学习资料,gzrq99@163.com
hbhbhbhbhb1021 2005-09-07
  • 打赏
  • 举报
回复
嘿嘿,不好意思,大大超过五分钟了啊,哎,要多努力
hbhbhbhbhb1021 2005-09-07
  • 打赏
  • 举报
回复
<script language=javascript>
function d123()
{
if(document.all.a123.selectedIndex!=0)
{
var value=document.all.a123.options[document.all.a123.selectedIndex].value;
var text=document.all.a123.options[document.all.a123.selectedIndex].text;
var value1=document.all.a123.options[document.all.a123.selectedIndex-1].value;
var text1=document.all.a123.options[document.all.a123.selectedIndex-1].text;
var selectedIndex=document.all.a123.selectedIndex;
var upselectedIndex=document.all.a123.selectedIndex-1

document.all.a123.options[selectedIndex]=new Option(value1,text1);
document.all.a123.options[upselectedIndex]=new Option(value,text);
}
}
function e123()
{
if(document.all.a123.selectedIndex!=document.all.a123.options.length)
{
var value=document.all.a123.options[document.all.a123.selectedIndex].value;
var text=document.all.a123.options[document.all.a123.selectedIndex].text;
var value1=document.all.a123.options[document.all.a123.selectedIndex+1].value;
var text1=document.all.a123.options[document.all.a123.selectedIndex+1].text;
var selectedIndex=document.all.a123.selectedIndex;
var upselectedIndex=document.all.a123.selectedIndex+1

document.all.a123.options[selectedIndex]=new Option(value1,text1);
document.all.a123.options[upselectedIndex]=new Option(value,text);
}
}

</script>
<select name=a123 size=5>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<input name=c123 type=button value="上移" onclick=d123()>
<input name=f123 type=button value="下移" onclick=e123()>
hbhbhbhbhb1021 2005-09-07
  • 打赏
  • 举报
回复
你说的长度是指什么,select框的宽度?
可以指定的
<select name=a123 style="width:100">
</select>
上移下移的代码,五分钟后你再来看看
visual_alan 2005-09-07
  • 打赏
  • 举报
回复
多谢。再请问
1、select框的长度可以指定吗?(因为数据都是从数据库中读取的,如果不是固定的话,很不方便)
2、想在请求在同一select框中,上移、下移的功能代码。
1
2
3
4
move up move down
hbhbhbhbhb1021 2005-09-06
  • 打赏
  • 举报
回复
要下班了,时间太短,写了一个,基本功能实现了,你在自己测试下什么都不选等其他情况
<script language=javascript>
function d123()
{
var value=document.all.a123.options[document.all.a123.selectedIndex].value;
var text=document.all.a123.options[document.all.a123.selectedIndex].text;
document.all.a123.options[document.all.a123.selectedIndex]=null;
document.all.b123.options[document.all.b123.options.length]=new Option(value,text);
}
function e123()
{
var value=document.all.b123.options[document.all.b123.selectedIndex].value;
var text=document.all.b123.options[document.all.b123.selectedIndex].text;
document.all.b123.options[document.all.b123.selectedIndex]=null;
document.all.a123.options[document.all.a123.options.length]=new Option(value,text);
}
</script>
<select name=a123 size=5>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
</select>
<input name=c123 type=button value="-->" onclick=d123()>
<input name=f123 type=button value="<--" onclick=e123()>
<select name=b123 size=5>
<option value="5">5</option>
<option value="6">6</option>
<option value="7">7</option>
<option value="8">8</option>
</select>

87,996

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧