<script>
function move(bool)
{
if(document.all.mysel.selectedIndex>=0)
{
i=bool=="up"?-1:1;
myvalue=document.all.mysel.options[document.all.mysel.selectedIndex+i].value;
mytext=document.all.mysel.options[document.all.mysel.selectedIndex+i].text;
document.all.mysel.options[document.all.mysel.selectedIndex+i].value=document.all.mysel.options[document.all.mysel.selectedIndex].value;
document.all.mysel.options[document.all.mysel.selectedIndex+i].text=document.all.mysel.options[document.all.mysel.selectedIndex].text;
document.all.mysel.options[document.all.mysel.selectedIndex].value=myvalue;
document.all.mysel.options[document.all.mysel.selectedIndex].text=mytext;
}
}
function set()
{
if(document.all.mysel.selectedIndex==0)
document.all.up.disabled=true;
else
document.all.up.disabled=false;
if(document.all.mysel.selectedIndex==document.all.mysel.options.length-1)
document.all.down.disabled=true;
else
document.all.down.disabled=false;
}
function del()
{
if(document.all.mysel.selectedIndex>=0)
document.all.mysel.options[document.all.mysel.selectedIndex]=null;
}
</script>
<body onload=set()>
<select id=mysel size=4 onchange=set()>
<option value=1 selected>1
<option value=2>2
<option value=3>3
<option value=4>4
</select>
<input type=button value=up id=up onclick=move("up")>
<input type=button value=down id=down onclick=move("down")>
<input type=button value=del id=del onclick=del()>
function move(bool)
{
if(document.all.mysel.selectedIndex>=0)
{
i=bool=="up"?-1:1;
myvalue=document.all.mysel.options[document.all.mysel.selectedIndex+i].value;
mytext=document.all.mysel.options[document.all.mysel.selectedIndex+i].text;
document.all.mysel.options[document.all.mysel.selectedIndex+i].value=document.all.mysel.options[document.all.mysel.selectedIndex].value;
document.all.mysel.options[document.all.mysel.selectedIndex+i].text=document.all.mysel.options[document.all.mysel.selectedIndex].text;
document.all.mysel.options[document.all.mysel.selectedIndex].value=myvalue;
document.all.mysel.options[document.all.mysel.selectedIndex].text=mytext;
}
}
function set()
{
if(document.all.mysel.selectedIndex==0)
document.all.up.disabled=true;
else
document.all.up.disabled=false;
if(document.all.mysel.selectedIndex==document.all.mysel.options.length-1)
document.all.down.disabled=true;
else
document.all.down.disabled=false;
}
function del()
{
if(document.all.mysel.selectedIndex>=0)
document.all.mysel.options[document.all.mysel.selectedIndex]=null;
}
</script>
<body onload=set()>
<select id=mysel size=4 onchange=set()>
<option value=1 selected>1
<option value=2>2
<option value=3>3
<option value=4>4
</select>
<input type=button value=up id=up onclick=move("up")>
<input type=button value=down id=down onclick=move("down")>
<input type=button value=del id=del onclick=del()>
解决方案 »
- JS的这个问题怎么解决(不知道怎么去描述它)
- 如何将1000000000.00转换成1,000,000,000.00
- 关于form中取值问题
- 请教:用户登录验证问题
- 窗口之间的交互
- 急救:怎么通过javascript调用局域网机子上的程序?
- 请教高手2急切!!!!!!!!!!!
- 谁有验证金额或浮点数的javascript脚本?
- 如果用JS动态创建一个FORM和一些INPUT,然后提交,会不会提交成功?
- js的function 方法中如何把bigdecimal类型的数字格式化成 “00”形式字符
- 请帮我看看以下代码错在哪里?错误提示是:缺少对象!谢谢
- 急!javascrip如何调用word控件,使它具有将word文档转成html的功能???
<script>
function move(bool)
{
if(document.all.mysel.selectedIndex>=0)
{
i=bool=="up"?-1:1;
document.all.mysel.selectedIndex+=i;
set();
/*
myvalue=document.all.mysel.options[document.all.mysel.selectedIndex+i].value;
mytext=document.all.mysel.options[document.all.mysel.selectedIndex+i].text;
document.all.mysel.options[document.all.mysel.selectedIndex+i].value=document.all.mysel.options[document.all.mysel.selectedIndex].value;
document.all.mysel.options[document.all.mysel.selectedIndex+i].text=document.all.mysel.options[document.all.mysel.selectedIndex].text;
document.all.mysel.options[document.all.mysel.selectedIndex].value=myvalue;
document.all.mysel.options[document.all.mysel.selectedIndex].text=mytext;
*/
}
}
function set()
{
if(document.all.mysel.selectedIndex==0)
document.all.up.disabled=true;
else
document.all.up.disabled=false;
if(document.all.mysel.selectedIndex==document.all.mysel.options.length-1)
document.all.down.disabled=true;
else
document.all.down.disabled=false;
}
function del()
{
if(document.all.mysel.selectedIndex>=0)
document.all.mysel.options[document.all.mysel.selectedIndex]=null;
}
</script>
<body onload=set()>
<select id=mysel size=4 onchange=set()>
<option value=1 selected>1
<option value=2>2
<option value=3>3
<option value=4>4
</select>
<input type=button value=up id=up onclick=move("up")>
<input type=button value=down id=down onclick=move("down")>
<input type=button value=del id=del onclick=del()>
function move(bool)
{
if(document.all.mysel.selectedIndex>=0)
{
i=bool=="up"?-1:1;
myvalue=document.all.mysel.options[document.all.mysel.selectedIndex+i].value;
mytext=document.all.mysel.options[document.all.mysel.selectedIndex+i].text;
document.all.mysel.options[document.all.mysel.selectedIndex+i].value=document.all.mysel.options[document.all.mysel.selectedIndex].value;
document.all.mysel.options[document.all.mysel.selectedIndex+i].text=document.all.mysel.options[document.all.mysel.selectedIndex].text;
document.all.mysel.options[document.all.mysel.selectedIndex].value=myvalue;
document.all.mysel.options[document.all.mysel.selectedIndex].text=mytext;
document.all.mysel.selectedIndex+=i;
set();
}
}
function set()
{
if(document.all.mysel.selectedIndex==0)
document.all.up.disabled=true;
else
document.all.up.disabled=false;
if(document.all.mysel.selectedIndex==document.all.mysel.options.length-1)
document.all.down.disabled=true;
else
document.all.down.disabled=false;
}
function del()
{
if(document.all.mysel.selectedIndex>=0)
document.all.mysel.options[document.all.mysel.selectedIndex]=null;
}
</script>
<body onload=set()>
<select id=mysel size=4 onchange=set()>
<option value=1 selected>1
<option value=2>2
<option value=3>3
<option value=4>4
</select>
<input type=button value=up id=up onclick=move("up")>
<input type=button value=down id=down onclick=move("down")>
<input type=button value=del id=del onclick=del()>