⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sc.ascx

📁 asp.net 2.0的教务管理软件源码
💻 ASCX
字号:
<%@ Control Language="C#"  AutoEventWireup="true" CodeFile="SC.ascx.cs" Inherits="uctl_SC" %>
<script language="javascript" type="text/javascript">
// <!CDATA[
var lstSource,lstTarget,hiddenValues,hiddenUnSelect,dest;

function initControl(lstSource1,lstTarget1,hiddenValues1,hiddenUnSelect1) 
{
 //  alert(lstSource);
   lstSource = document.getElementById(lstSource1);
   lstTarget = document.getElementById(lstTarget1);
   hiddenValues =document.getElementById(hiddenValues1);
   hiddenUnSelect = document.getElementById(hiddenUnSelect1);
}

function exchange(dest)
{
    if (dest == 0)
    {
        ls = lstSource;
        lt = lstTarget;
    }
    else
    {
        ls = lstTarget;
        lt = lstSource;
    }
    
    if (ls.selectedIndex >= 0)
    {
        for(i = 0; i < ls.length; i++)
        {
            if (ls.options[i].selected)
            {
                lt.options.add(new Option(ls.options[i].text, ls.options[i].value));
            }
        }
        for(i = ls.length - 1; i >= 0; i--)
        {
            if (ls.options[i].selected)
            {
                ls.options.remove(i);
            }
        }
    }
    getValue(dest);
}

function getValue(dest)
{
    var i;
    var s1 = "";
    var s2 = "";
    if (dest == 0)
    {
        ls = lstSource;
        lt = lstTarget;
    }
    else
    {
        ls = lstTarget;
        lt = lstSource;
    }

   for (i = 0; i < lt.length; i++)
    {
        if (i > 0) s1 += ",";
        s1 += lt.options[i].value;
    }

    for (i = 0; i < ls.length; i++)
    {
        if (i > 0) s2 += ",";
        s2 += ls.options[i].value;
    }
    
   if(dest!=0)
   {
        hiddenValues.value = s1;
        hiddenUnSelect.value = s2;
   }
   else
   {
        hiddenValues.value = s2;
        hiddenUnSelect.value =s1;
   }
}
// ]]>
</script>
    <div style="z-index: 101; left: 2px; width: 40px; position: relative; top: 2px; height: 37px">
        <div style="z-index: 101; left: 1px; width: 173px; position: absolute; top: 24px;
            height: 177px">
            <select id="lstSelectedCourse" runat="server" multiple="True" name="lstSelectedCourse" style="width: 100%; height: 100%" />
        </div>
        <div id="DIV1" style="z-index: 102; left: 214px; width: 150px; position: absolute;
            top: 24px; height: 177px">
            <select id="lstAvaiableCourse" runat="server" multiple="True" name="lstAvaiableCourse"
                size="4" style="width: 125%; height: 100%" />
        </div>
        <div style="z-index: 103; left: 177px; width: 28px; position: absolute; top: 77px;
            height: 55px">
            <asp:Button ID="btnAdd" runat="server" Text="<-" Width="33px" Height="24px" /><br />
            <br />
            <asp:Button ID="btnRemove" runat="server" Text="->" Width="33px" /></div>
        <div align="center" style="z-index: 104; left: 20px; width: 132px; position: absolute;
            top: 5px; height: 11px">
            <asp:Label ID="lblTargetName" runat="server" Text="Label"></asp:Label></div>
        <div align="center" style="z-index: 104; left: 243px; width: 132px; position: absolute;
            top: 5px; height: 11px">
            <asp:Label ID="lblSourceName" runat="server" Text="Label"></asp:Label></div>
    </div>    <asp:HiddenField ID="hiddenValues"  runat="server" />
 <asp:HiddenField ID="hiddenUnSelect"  runat="server" />
    <asp:Label runat="server" ID="lblForLastJS"></asp:Label>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -