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 PROTECTED]

Reply via email to