PHP视频教学,让你更快更轻松的掌握PHP。

查看完整版本: 像设置播放列表一样的东西

Double 2007-10-15 15:28

像设置播放列表一样的东西

[code]<link rel="stylesheet" type="text/css" href="/theme/1/style.css">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">

<script>
function func_insert()
{
for (i=0; i<select2.options.length; i++)
{
   if(select2.options(i).selected)
   {
     option_text=select2.options(i).text;
     option_value=select2.options(i).value;
     option_style_color=select2.options(i).style.color;

     var my_option = document.createElement("OPTION");
     my_option.text=option_text;
     my_option.value=option_value;
     my_option.style.color=option_style_color;

     pos=select2.options.length;
     select1.add(my_option,pos);
     select2.remove(i);
     i--;
  }
}//for
}

function func_delete()
{
for (i=0;i<select1.options.length;i++)
{
   if(select1.options(i).selected)
   {
     option_text=select1.options(i).text;
     option_value=select1.options(i).value;

     var my_option = document.createElement("OPTION");
     my_option.text=option_text;
     my_option.value=option_value;

     if(option_text.indexOf("[必选]")>0)
        return;
     pos=select2.options.length;
     select2.add(my_option,pos);
     select1.remove(i);
     i--;
  }
}//for
}

function func_select_all1()
{
for (i=select1.options.length-1; i>=0; i--)
   select1.options(i).selected=true;
}

function func_select_all2()
{
for (i=select2.options.length-1; i>=0; i--)
   select2.options(i).selected=true;
}

function func_up()
{
  sel_count=0;
  for (i=select1.options.length-1; i>=0; i--)
  {
    if(select1.options(i).selected)
       sel_count++;
  }

  if(sel_count==0)
  {
     alert("调整桌面模块的顺序时,请选择其中一项!");
     return;
  }
  else if(sel_count>1)
  {
     alert("调整桌面模块的顺序时,只能选择其中一项!");
     return;
  }

  i=select1.selectedIndex;

  if(i!=0)
  {
    var my_option = document.createElement("OPTION");
    my_option.text=select1.options(i).text;
    my_option.value=select1.options(i).value;

    select1.add(my_option,i-1);
    select1.remove(i+1);
    select1.options(i-1).selected=true;
  }
}

function func_down()
{
  sel_count=0;
  for (i=select1.options.length-1; i>=0; i--)
  {
    if(select1.options(i).selected)
       sel_count++;
  }

  if(sel_count==0)
  {
     alert("调整桌面模块的顺序时,请选择其中一项!");
     return;
  }
  else if(sel_count>1)
  {
     alert("调整桌面模块的顺序时,只能选择其中一项!");
     return;
  }

  i=select1.selectedIndex;

  if(i!=select1.options.length-1)
  {
    var my_option = document.createElement("OPTION");
    my_option.text=select1.options(i).text;
    my_option.value=select1.options(i).value;

    select1.add(my_option,i+2);
    select1.remove(i);
    select1.options(i+1).selected=true;
  }
}

function mysubmit()
{
   fld_str="";
   for (i=0; i< select1.options.length; i++)
   {
      options_value=select1.options(i).value;
      fld_str+=options_value+",";
    }

   location="submit.php?POS=MYTABLE_LEFT&FLD_STR=" + fld_str;
}
</script>
</head>

<body class="bodycolor" topmargin="5">

<table width="500" border="1" cellspacing="0" cellpadding="3" align="center" bordercolorlight="#000000" bordercolordark="#FFFFFF" class="big">
  <tr bgcolor="#CCCCCC">
    <td align="center">排序</td>
    <td align="center"><b>显示以下桌面模块</b></td>
    <td align="center">选择</td>
    <td align="center" valign="top"><b>备选桌面模块</b></td>
  </tr>
  <tr>
    <td align="center" bgcolor="#999999">
      <input type="button" class="SmallInput" value=" ↑ " onclick="func_up();">
      <br><br>
      <input type="button" class="SmallInput" value=" ↓ " onclick="func_down();">
    </td>
    <td valign="top" align="center" bgcolor="#CCCCCC">
    <select  name="select1" ondblclick="func_delete();" MULTIPLE style="width:200;height:280">
       <option value="1">公告通知[必选]</option>

       <option value="3">待办事宜[必选]</option>

       <option value="8">在线时长排行榜</option>

    </select>
    <input type="button" value=" 全 选 " onclick="func_select_all1();" class="SmallInput">
    </td>

    <td align="center" bgcolor="#999999">
      <input type="button" class="SmallInput" value=" ← " onclick="func_insert();">
      <br><br>
      <input type="button" class="SmallInput" value=" → " onclick="func_delete();">
    </td>

    <td align="center" valign="top" bgcolor="#CCCCCC">
    <select  name="select2" ondblclick="func_insert();" MULTIPLE style="width:200;height:280">
       <option value="4">今日日程</option>
       <option value="2">新闻</option>
       <option value="7">常用网址</option>
       <option value="10">外出人员公告牌</option>
       <option value="9">投票</option>
       <option value="13">今日计划</option>
       <option value="15">内部讨论区</option>
       <option value="17">网络硬盘</option>
    </select>
    <input type="button" value=" 全 选 " onclick="func_select_all2();" class="SmallInput">
    </td>
  </tr>

  <tr bgcolor="#CCCCCC">
    <td align="center" valign="top" colspan="4">
    点击条目时,可以组合CTRL或SHIFT键进行多选<br>
      <input type="button" class="BigButton" value="保 存" onclick="mysubmit();">   
      <input type="button" class="BigButton" value="重 置" onclick="location.reload()">
    </td>
  </tr>

</table>

</body>
</html>[/code]
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
运行后的效果在附件的里
页: [1]
查看完整版本: 像设置播放列表一样的东西