列表项可上下移动的Multiple列表
程序员文章站
2022-06-10 18:19:36
<html>
<head>
<title> new document </title>
<meta name="generator" content="editplus">
<meta name="author" content="">
<meta name="keywords" content="">
<meta name="description" content="">
<style>
body, select
{
font-family: times new roman;
font-size: 10pt;
}
</style>
<script language="javascript">
<!--
window.onload = initpage;
function initpage()
{
btnputup.onclick = putup;
btnputdown.onclick = putdown;
btngoup.onclick = goup;
btngodown.onclick = godown;
}
function putup()
{
var strtempvalue;
var strtemptext;
var intcurindex;
intcurindex = sltfruit.selectedindex;
//alert("intcurindex: " + intcurindex);
if (intcurindex > 0)
{
strtempvalue= sltfruit.options.item(intcurindex).value;
strtemptext = sltfruit.options.item(intcurindex).text;
//alert(strtemptext + " - " + strtempvalue);
sltfruit.options.item(intcurindex).value = sltfruit.options.item(intcurindex - 1).value;
sltfruit.options.item(intcurindex).text = sltfruit.options.item(intcurindex - 1).text;
sltfruit.options.item(intcurindex - 1).value= strtempvalue;
sltfruit.options.item(intcurindex - 1).text = strtemptext;
sltfruit.selectedindex = intcurindex - 1;
}
}
function putdown()
{
var strtempvalue;
var strtemptext;
var intcurindex;
var intindexcount;
intcurindex = sltfruit.selectedindex;
intindexcount = sltfruit.length;
//alert("intcurindex: " + intcurindex);
//alert("intindexcount: " + intindexcount);
if (intcurindex < intindexcount - 1)
{
strtempvalue= sltfruit.options.item(intcurindex).value;
strtemptext = sltfruit.options.item(intcurindex).text;
//alert(strtemptext + " - " + strtempvalue);
<head>
<title> new document </title>
<meta name="generator" content="editplus">
<meta name="author" content="">
<meta name="keywords" content="">
<meta name="description" content="">
<style>
body, select
{
font-family: times new roman;
font-size: 10pt;
}
</style>
<script language="javascript">
<!--
window.onload = initpage;
function initpage()
{
btnputup.onclick = putup;
btnputdown.onclick = putdown;
btngoup.onclick = goup;
btngodown.onclick = godown;
}
function putup()
{
var strtempvalue;
var strtemptext;
var intcurindex;
intcurindex = sltfruit.selectedindex;
//alert("intcurindex: " + intcurindex);
if (intcurindex > 0)
{
strtempvalue= sltfruit.options.item(intcurindex).value;
strtemptext = sltfruit.options.item(intcurindex).text;
//alert(strtemptext + " - " + strtempvalue);
sltfruit.options.item(intcurindex).value = sltfruit.options.item(intcurindex - 1).value;
sltfruit.options.item(intcurindex).text = sltfruit.options.item(intcurindex - 1).text;
sltfruit.options.item(intcurindex - 1).value= strtempvalue;
sltfruit.options.item(intcurindex - 1).text = strtemptext;
sltfruit.selectedindex = intcurindex - 1;
}
}
function putdown()
{
var strtempvalue;
var strtemptext;
var intcurindex;
var intindexcount;
intcurindex = sltfruit.selectedindex;
intindexcount = sltfruit.length;
//alert("intcurindex: " + intcurindex);
//alert("intindexcount: " + intindexcount);
if (intcurindex < intindexcount - 1)
{
strtempvalue= sltfruit.options.item(intcurindex).value;
strtemptext = sltfruit.options.item(intcurindex).text;
//alert(strtemptext + " - " + strtempvalue);