📄 layout.js
字号:
function MoveUp(SelectList)
{
var nIndex = SelectList.selectedIndex;
if (nIndex == -1)
{
// Process continue only if at least one item selected
alert("是不是忘了先选一项?^-^");
return;
}
if (nIndex == 0)
{
// Already at the top position
return;
}
// Exchange item selected with previous one
var objSelected = new Option(SelectList[nIndex].text, SelectList[nIndex].value);
var objPrevious = new Option(SelectList[nIndex-1].text, SelectList[nIndex-1].value);
SelectList.options[nIndex] = objPrevious;
SelectList.options[nIndex-1] = objSelected;
// Select item previous selected
SelectList.options[nIndex-1].selected = true;
}
function MoveDown(SelectList)
{
var nIndex = SelectList.selectedIndex;
if (nIndex == -1)
{
// Process continue only if at least one item selected
alert("是不是忘了先选一项?^-^");
return;
}
if (nIndex == SelectList.options.length-1)
{
// Already at the bottom position
return;
}
// Exchange item selected with previous one
var objSelected = new Option(SelectList[nIndex].text, SelectList[nIndex].value);
var objPrevious = new Option(SelectList[nIndex+1].text, SelectList[nIndex+1].value);
SelectList.options[nIndex] = objPrevious;
SelectList.options[nIndex+1] = objSelected;
// Select item previous selected
SelectList.options[nIndex+1].selected = true;
}
function Remove(SelectList)
{
var nIndex = SelectList.selectedIndex;
if (nIndex == -1)
{
// Process continue only if at least one item selected
alert("是不是忘了先选一项?^-^");
return;
}
SelectList.options[nIndex] = null;
if(navigator.appName=="Netscape")
{
history.go(0)
}
}
function RemoveAll(SelectList)
{
while (SelectList.length!=0)
SelectList.options[0] = null;
if(navigator.appName=="Netscape")
{
history.go(0)
}
}
function Move(SourceList,TargetList)
{
var nIndex = SourceList.selectedIndex;
if (nIndex == -1)
{
// Process continue only if at least one item selected
alert("是不是忘了先选一项?^-^");
return;
}
var objSelected = new Option(SourceList[nIndex].text, SourceList[nIndex].value);
TargetList.options[TargetList.length] = objSelected;
SourceList.options[nIndex] = null;
// Select target item
TargetList.options[TargetList.length-1].selected = true;
if(navigator.appName=="Netscape")
{
history.go(0)
}
}
function Add(SourceList,TargetList)
{
var nIndex = SourceList.selectedIndex;
if (nIndex == -1)
{
// Process continue only if at least one item selected
alert("是不是忘了先选一项?^-^");
return;
}
for (i=0;i<TargetList.length;i++)
{
if (TargetList.options[i].value==SourceList.options[nIndex].value)
return;
}
var objSelected = new Option(SourceList[nIndex].text, SourceList[nIndex].value);
TargetList.options[TargetList.length] = objSelected;
if(navigator.appName=="Netscape")
{
history.go(0)
}
}
function Savelist(SelectList,NumberList,strResult)
{
var result="";
for (i=0;i<SelectList.length;i++)
{
result = result+"{"+SelectList.options[i].value+" "+NumberList.options[NumberList.selectedIndex].value+"}"+" ";
}
strResult.value = result;
}
function SaveLayout(SelectList,strResult)
{
var result="";
for (i=0;i<SelectList.length;i++)
{
result = result+"{"+SelectList.options[i].text+" "+SelectList.options[i].value+"}"+" ";
}
strResult.value = result;
}
function SaveLayoutValue(SelectList,strResult)
{
var result="";
for (i=0;i<SelectList.length;i++)
{
result = result+SelectList.options[i].value;
if(i<SelectList.length-1)
{
result =result+"|"
}
}
strResult.value = result;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -