problem on client side script

0 views
Skip to first unread message

viji

unread,
Oct 4, 2005, 7:38:46 AM10/4/05
to Techdot...@googlegroups.com
hi friends,
in this client side script code how to get list2 (listbox) values to a textbox......
if anyone know pls tell me..
when i click the button before itself i have assign all the values of list2 to a textbox..
ex:if listbox have values(4 items) like 3,4,2,1  textbox val should be  3,4,2,1
 
<%@ Page language="c#" Codebehind="WebForm7.aspx.cs" AutoEventWireup="false" Inherits="WebApplication1.WebForm7" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<HTML>
 <HEAD>
  <title>WebForm7</title>
  <script language="javascript">
<!-- browser detection adapted from code at netscape.com
// selSwitch functions
function selSwitch(btn)
{
   var i= btnType = 0;
   var isList1 = doIt = false;
   if (btn.value == "  >  " || btn.value == "  <  ")
      btnType = 1;
   else if (btn.value == " >> " || btn.value == " << ")
      btnType = 2;
   else
      btnType = 3;
   with (document.myForm)
   {
      isList1 = (btn.value.indexOf('>') != -1) ? true : false;    
      with ( ((isList1)? list1: list2) )
      {
         for (i = 0; i < length; i++)
         {
            doIt = false;
            if (btnType == 1)
            {
               if(options[i].selected) doIt = true;
            }
            else if (btnType == 2)
            {
               doIt = true;
            }
            else
               if (!options[i].selected) doIt = true;
            
            if (doIt)
            {
               with (options[i])
               {
                  if (isList1)
                     list2.options[list2.length]
                     = new Option( text, value );
                  else
                     list1.options[list1.length]
                     = new Option( text, value );
               }
               options[i] = null;
               i--;
            }
         } // end for loop
         if (options[0] != null)
            options[0].selected = true;
           
      } // end with islist1
   } // end with document
}
//--> end hide JavaScript
  </script>
 </HEAD>
 <body MS_POSITIONING="GridLayout">
  <TABLE height="391" cellSpacing="0" cellPadding="0" width="241" border="0" ms_2d_layout="TRUE">
   <TR vAlign="top">
    <TD width="241" height="391">
     <form id="myForm" name="myForm" runat="server">
      <TABLE height="224" cellSpacing="0" cellPadding="0" width="379" border="0" ms_2d_layout="TRUE">
       <TR vAlign="top">
        <TD width="10" height="15"></TD>
        <TD width="68"></TD>
        <TD width="78"></TD>
        <TD width="42"></TD>
        <TD width="4"></TD>
        <TD width="9"></TD>
        <TD width="50"></TD>
        <TD width="80"></TD>
        <TD width="38" rowSpan="2"></TD>
       </TR>
       <TR vAlign="top">
        <TD height="46"></TD>
        <TD><br>
        </TD>
        <TD colSpan="2" rowSpan="2"><asp:listbox id="list1" runat="server"></asp:listbox></TD>
        <TD colSpan="3"></TD>
        <TD rowSpan="2"><asp:listbox id="list2" runat="server"></asp:listbox></TD>
       </TR>
       <TR vAlign="top">
        <TD colSpan="2" height="24"></TD>
        <TD colSpan="2"></TD>
        <TD><input onclick="selSwitch(this);" type="button" value="  >  "></TD>
        <TD><input onclick="selSwitch(this);" type="button" value="  <  "></TD>
       </TR>
       <TR vAlign="top">
        <TD colSpan="3" height="91"></TD>
        <TD><input onclick="selSwitch(this);" type="button" value=" >> "></TD>
        <TD colSpan="3"><input onclick="selSwitch(this);" type="button" value=" << "></TD>
        <TD colSpan="2" rowSpan="2"></TD>
       </TR>
       <TR vAlign="top">
        <TD colSpan="5" height="25"></TD>
        <TD colSpan="2"><asp:button id="Button1" runat="server" Text="Button"></asp:button></TD>
       </TR>
       <TR vAlign="top">
        <TD colSpan="3" height="23"><input type="text" id="t1"></TD>
        <TD colSpan="6"></TD>
       </TR>
      </TABLE>
     </form>
    </TD>
   </TR>
  </TABLE>
 </body>
</HTML>

regars,
viji.


Yahoo! for Good
Click here to donate to the Hurricane Katrina relief effort.

Reply all
Reply to author
Forward
0 new messages