·您的位置: 首页 » 资源教程 » 编程开发 » ASP » 列表项可上下移动的MULTIPLE列表

列表项可上下移动的MULTIPLE列表

类别: ASP教程  评论数:0 总得分:0
<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);

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 goUp()
{
var intCurIndex;
intCurIndex = sltCountry.selectedIndex;

if (intCurIndex > 0)
sltCountry.selectedIndex = intCurIndex - 1;
}

function goDown()
{
var intCurIndex;
var intIndexCount;

intCurIndex = sltCountry.selectedIndex;
intIndexCount = sltCountry.length;

if (intCurIndex < intIndexCount - 1)
sltCountry.selectedIndex = intCurIndex + 1;
}
//-->
</SCRIPT>
</HEAD>

<BODY>

</BODY>
水果列表<BR>
1 - 香蕉<BR>
2 - 苹果<BR>
3 - 葡萄<BR>
4 - 桔子<BR>
5 - 西瓜<BR>
<SELECT NAME="sltFruit" SIZE="5">
<OPTION VALUE="1">香蕉</OPTION>
<OPTION VALUE="2">苹果</OPTION>
<OPTION VALUE="3">葡萄</OPTION>
<OPTION VALUE="4">桔子</OPTION>
<OPTION VALUE="5">西瓜</OPTION>
</SELECT>

<INPUT TYPE="BUTTON" ID="btnPutUp" VALUE="上移">
<INPUT TYPE="BUTTON" ID="btnPutDown" VALUE="下移">
<HR>

国家列表<BR>
1 - China<BR>
2 - USA<BR>
3 - USSR<BR>
4 - England<BR>
5 - France<BR>
<SELECT NAME="sltCountry">
<OPTION VALUE="1">China</OPTION>
<OPTION VALUE="2">USA</OPTION>
<OPTION VALUE="3">USSR</OPTION>
<OPTION VALUE="4">England</OPTION>
<OPTION VALUE="5">France</OPTION>
</SELECT>

<INPUT TYPE="BUTTON" ID="btnGoUp" VALUE="上移">
<INPUT TYPE="BUTTON" ID="btnGoDown" VALUE="下移">
</HTML>
-= 资 源 教 程 =-
文 章 搜 索
关键词:
类型:
范围:
纯粹空间 softpure.com
Copyright © 2006-2008 暖阳制作 版权所有
QQ: 15242663 (拒绝闲聊)  Email: faisun@sina.com
 纯粹空间 - 韩国酷站|酷站欣赏|教程大全|资源下载|免费博客|美女壁纸|设计素材|技术论坛   Valid XHTML 1.0 Transitional
百度搜索 谷歌搜索 Alexa搜索 | 粤ICP备19116064号-1