Chris,

I'm sorry, I thought the original post was asking how to get re-select the
value that was that chosen from the drop-down box once the form was
submitted.

My bad!

--Ben

----- Original Message -----
From: "Chris Tifer" <[EMAIL PROTECTED]>
To: "ActiveServerPages" <[EMAIL PROTECTED]>
Sent: Friday, November 01, 2002 12:15 PM
Subject: Re: set listbox value selected


> I think you're responding to a different post Benjamin, and if it's
> the one where the user wanted to pull out name/value pairs of the
> query string, isn't that only going to pull the first name/value pair
> and not all of them?
>
> I have a VBScript snippet that you might be able to look at to
> get an idea on how to modify it to JScript:
>
> DIM arrKeyValues
> arrKeyValues = SPLIT(loginCookie, ";")
>
> DIM i
> FOR i = LBOUND(arrKeyValues) TO UBOUND(arrKeyValues)
>  DIM arrCookieKey
>  arrCookieKey = SPLIT(arrKeyValues(i), "=")
>  IF LCASE(arrCookieKey(0)) = LCASE(strCookieKey) THEN
>   strCookieValue = arrCookieKey(1)
>  END IF
> NEXT
>
>
> What I'd do is pass in a string and a key (name) that I was looking for.
> My cookie keys were delimited with a ";". Then, later on, I split that
> key with a "=" which gives me the name of the key and value into an
> array - key being arrCookieKey(0), and value being arrCookieKey(1)
>
> The code will look very similar just different syntax and the string
> you're going to pass in would be the location.search as Benjamin
mentioned.
> You will just have to split on a different delimiter.
>
> If you really don't know much JavaScript, let me know and I'll try to help
> you
> with the syntax...
>
> Chris Tifer
> http://www.emailajoke.com
>
>
> ----- Original Message -----
> From: "Benjamin Garcia" <[EMAIL PROTECTED]>
> To: "ActiveServerPages" <[EMAIL PROTECTED]>
> Sent: Friday, November 01, 2002 12:44 PM
> Subject: Re: set listbox value selected
>
>
> > The js statement you're looking for is "location.search".  It will
display
> > everything in the querystring, including the question mark.
> >
> > Try something like:
> >
> > <script lanaguage="javascript">
> >     function initPage()
> >     {
> >         if (location.search != "")
> >         {
> >             var arrLoc = location.search.split("=");
> >             document.form1.selReports.options.selectedIndex = arrLoc[1];
> >         }
> >     }
> >
> >     onload=initPage;
> > </script>
> >
> > --Ben
> >
> > ----- Original Message -----
> > From: "LeGrand Decius" <[EMAIL PROTECTED]>
> > To: "ActiveServerPages" <[EMAIL PROTECTED]>
> > Sent: Friday, November 01, 2002 11:10 AM
> > Subject: Re: set listbox value selected
> >
> >
> > > Thanks for responding.
> > >
> > > I'm trying to do this with client-site Javascript.  I have achieve
this
> > task
> > > with ASP but would rather do it with client-side javascripts.
> > >
> > >
> > > ----- Original Message -----
> > > From: "Chris Tifer" <[EMAIL PROTECTED]>
> > > To: "ActiveServerPages" <[EMAIL PROTECTED]>
> > > Sent: Friday, November 01, 2002 12:02 PM
> > > Subject: Re: set listbox value selected
> > >
> > >
> > > > Are you trying to do this with client-side JavaScript or with ASP
> since
> > > the
> > > > page submits to itself and you can determine it then?
> > > >
> > > > Chris Tifer
> > > >
> > > > ----- Original Message -----
> > > > From: "LeGrand Decius" <[EMAIL PROTECTED]>
> > > > To: "ActiveServerPages" <[EMAIL PROTECTED]>
> > > > Sent: Friday, November 01, 2002 11:54 AM
> > > > Subject: set listbox value selected
> > > >
> > > >
> > > > > Below I have a sample page with a listbox that submits to itself.
> > > > > How can I set the default selected value based on the previous
> > > selection?
> > > > > =================================================
> > > > > <html>
> > > > > <head>
> > > > > <title>Test</title>
> > > > > <meta http-equiv="Content-Type" content="text/html;
> > charset=iso-8859-1">
> > > > > <SCRIPT language=JavaScript>
> > > > > function getSelectedIndices (){
> > > > > var comboValue
> > > > > var selIndex = document.form1.selReports.selectedIndex;
> > > > > document.form1.sindex.value = selIndex;
> > > > > }
> > > > > </SCRIPT>
> > > > >
> > > > > </head>
> > > > >
> > > > > <body bgcolor="#FFFFFF" text="#000000">
> > > > > <form name="form1" method="post" action="Default_listbox.htm">
> > > > >   <p><select name="selReports" onChange="getSelectedIndices()">
> > > > >     <option value="0">Available Reports</option>
> > > > >     <option value="1">My Reports</option>
> > > > >     <option value="2">All Reports</option>
> > > > >   </select>
> > > > > </p>
> > > > >   <p>
> > > > >     <input type="submit" name="Submit" value="Submit">
> > > > >     <input type="hidden" name="sindex">
> > > > >   </p>
> > > > > </form>
> > > > > </body>
> > > > > </html>
> > > > >
> > > > >
> > > > >
> > > > > ---
> > > > > You are currently subscribed to activeserverpages as:
> > [EMAIL PROTECTED]
> > > > > To unsubscribe send a blank email to
> > > > %%email.unsub%%
> > > > >
> > > >
> > > >
> > > > ---
> > > > You are currently subscribed to activeserverpages as:
> > > [EMAIL PROTECTED]
> > > > To unsubscribe send a blank email to
> > > %%email.unsub%%
> > > >
> > >
> > >
> > > ---
> > > You are currently subscribed to activeserverpages as:
> [EMAIL PROTECTED]
> > > To unsubscribe send a blank email to
> > %%email.unsub%%
> >
> >
> > ---
> > You are currently subscribed to activeserverpages as: [EMAIL PROTECTED]
> > To unsubscribe send a blank email to
> %%email.unsub%%
>
>
> ---
> You are currently subscribed to activeserverpages as: [EMAIL PROTECTED]
> To unsubscribe send a blank email to
%%email.unsub%%


---
You are currently subscribed to activeserverpages as: [email protected]
To unsubscribe send a blank email to [EMAIL PROTECTED]

Reply via email to