Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Javascript] Getting info. from URL of a page that is in frames


  • From: javascript@xxxxxxxxxx (Peter-Paul Koch)
  • Subject: [Javascript] Getting info. from URL of a page that is in frames
  • Date: Fri, 25 May 2001 22:08:26 -0000

>Thanks for the help so far.  I've just realised that, because my page is 
>split into 3 frames, i'm not sure which of these frames will have access to 
>the URL - if any?

The frame you load the page in.

ppk

> >Now, when a user has to,for instance fill out a form, then I'd really 
>like
> >to be able to know what their username is...Can i parse this URL with
> >JavaScript once they've arrived at the homepage in order to discover 
>their
> >username?
>
>Sure
>
>var x = location.search;
>var y =new Array();
>y = x.split('&');
>
>Now the array y contains the name/value pairs of the query string. To find
>the user name, do
>
>for (i=0;i<y.length;i++)
>{
>   if (y[i].indexOf('user') == 0)
>   {
>     var z = new Array();
>     z = y[i].split('=');
>    username = z[1];
>   }
>}
>
>and the username is in variable 'username'.
>
>ppk
>_________________________________________________________________________
>Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.
>
>
>_______________________________________________
>Javascript mailing list
>Javascript@xxxxxxxxxx
>http://www.LaTech.edu/mailman/listinfo/javascript
>
>
>_______________________________________________
>Javascript mailing list
>Javascript@xxxxxxxxxx
>http://www.LaTech.edu/mailman/listinfo/javascript

_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.