selects.js
来自「JTBC网站内容管理系统是一套可扩充的网站内容管理系统」· JavaScript 代码 · 共 58 行
JS
58 行
selects = {
add: function(strid, strero, strers)
{
var tobj = strid;
if (tobj)
{
var ti, tstr, tisext;
for (ti = 0; ti < tobj.options.length; ti ++)
{
if (tobj.options[ti].text == strero && tobj.options[ti].value == strers)
{tisext = true;}
}
if (!tisext){tobj.options.add(new Option(strero, strers));}
}
},
remove: function(strid)
{
var tobj = strid;
if (tobj)
{
var tidx = tobj.selectedIndex;
if (!(tidx == -1)){tobj.options[tidx] = null;}
}
},
displace: function(strid, strindex, strkey)
{
if (strindex >= 0)
{
var tobj = strid;
if (tobj)
{
var tstrvalue, tstrtext;
tstrtext = tobj.options[strindex].text;
tstrvalue = tobj.options[strindex].value;
if (strkey == 38)
{
if (!(strindex == 0))
{
tobj.options[strindex].text = tobj.options[strindex - 1].text;
tobj.options[strindex].value = tobj.options[strindex - 1].value;
tobj.options[strindex - 1].text = tstrtext;
tobj.options[strindex - 1].value = tstrvalue;
}
}
if (strkey == 40)
{
if (!(strindex == (tobj.options.length - 1)))
{
tobj.options[strindex].text = tobj.options[strindex + 1].text;
tobj.options[strindex].value = tobj.options[strindex + 1].value;
tobj.options[strindex + 1].text = tstrtext;
tobj.options[strindex + 1].value = tstrvalue;
}
}
}
}
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?