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 (Steve Hearne)
- Subject: [Javascript] Getting info. from URL of a page that is in frames
- Date: Thu, 24 May 2001 15:00:36 +0100
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? Steve >>> gassinaumasis@xxxxxxxxxxx 05/23/01 04:24PM >>> >http://servername/servlet/WebClient/main?user=3Dstevehearne&pass=3Dmypassw= ord&server=3D127.0.0.1=20 > >Now, when a user has to,for instance fill out a form, then I'd really = like=20 >to be able to know what their username is...Can i parse this URL with=20 >JavaScript once they've arrived at the homepage in order to discover = their=20 >username? Sure var x =3D location.search; var y =3Dnew Array(); y =3D x.split('&'); Now the array y contains the name/value pairs of the query string. To = find=20 the user name, do for (i=3D0;i<y.length;i++) { if (y[i].indexOf('user') =3D=3D 0) { var z =3D new Array(); z =3D y[i].split('=3D'); username =3D 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=20 http://www.LaTech.edu/mailman/listinfo/javascript
- Prev by Date: [Javascript] Netscape fails when calling document.frames from within a FRAME
- Next by Date: [Javascript] including .js files i.js files
- Previous by thread: [Javascript] Netscape fails when calling document.frames from within a FRAME
- Next by thread: [Javascript] Getting info. from URL of a page that is in frames
- Index(es):