[Javascript] Extract portion of URL and place in form field

Andrew Dunn andrew at d2k.com.au
Sun May 19 20:40:41 CDT 2002


Try this (forgive the variable names):

var thestring;
var otherstring;
var locofequal;
	
thestring = window.location.search;
locofequal = thestring.indexOf("=");
otherstring = thestring.substring((locofequal + 1),thestring.length); 
alert(otherstring);


-----Original Message-----
From: Phillp Morgan [mailto:pmorgan at quickpages.net.au] 
Sent: Monday, 20 May 2002 11:51 AM
To: 'Andrew Dunn'
Subject: RE: [Javascript] Extract portion of URL and place in form field
Sensitivity: Confidential


I couldn't agree more.

Unfortunately, I'm under a ittle pressure to get this done for a promo we
are running, and much as I would love to spend the time learning, I simply
just don't have the opportunity right now.

But thanks anyway.

phill

> -----Original Message-----
> From: javascript-admin at LaTech.edu
> [mailto:javascript-admin at LaTech.edu]On
> Behalf Of Andrew Dunn
> Sent: Monday, 20 May 2002 11:19 AM
> To: 'javascript at LaTech.edu'
> Subject: RE: [Javascript] Extract portion of URL and place in form 
> field
> Sensitivity: Confidential
>
>
> If you want to learn you have to do a bit of research.
>
> -----Original Message-----
> From: Phillp Morgan [mailto:pmorgan at quickpages.net.au]
> Sent: Monday, 20 May 2002 11:40 AM
> To: javascript at LaTech.edu
> Subject: RE: [Javascript] Extract portion of URL and place in form
> field
> Sensitivity: Confidential
>
>
> Hi Andrew,
>
> Thanks for that tip. I was hoping for something a little more
> verbose.. Like the actual javascript..
>
> > -----Original Message-----
> > From: javascript-admin at LaTech.edu
> > [mailto:javascript-admin at LaTech.edu]On
> > Behalf Of Andrew Dunn
> > Sent: Monday, 20 May 2002 11:03 AM
> > To: 'javascript at LaTech.edu'
> > Subject: RE: [Javascript] Extract portion of URL and place in form 
> > field
> > Sensitivity: Confidential
> >
> >
> > Use the location.search property and use a split() funtion or some
> > other string function that will give you the text after the string.
> >
> > -----Original Message-----
> > From: Phillp Morgan [mailto:pmorgan at quickpages.net.au]
> > Sent: Monday, 20 May 2002 11:22 AM
> > To: javascript at latech.edu
> > Subject: [Javascript] Extract portion of URL and place in form field
> > Sensitivity: Confidential
> >
> >
> > Hi, I would like to grab the text after the '=' and place it in the
> > form field 'ticket'. This is a form with only one field,
> the formname
> > is 'sverify'
> >
> > This is the string...
> http://www.mysite.com/thanks.html?cbreceipt=Z54HKPT7
>
> I'm after the Z54HKPT7.
>
> How would I do this?
>
> Regards,
>
> Phillip Morgan
> Chief Information Offier
> Quickpages Business Directories
> --------------------------------------------------------------
> --------------
> ------------
> This email is intended for the above named recipient only, and may
> contain priveledged information. If you are not the intended
> recipient please delete
> this email immediately and notify Quickpages of the problem.
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu 
> https://lists.LaTech.edu/mailman/listinfo/javascript
>
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu
> https://lists.LaTech.edu/mailman/listinfo/javascript
> _______________________________________________
> Javascript mailing list
> Javascript at LaTech.edu 
> https://lists.LaTech.edu/mailman/listinfo/javascript
>




More information about the Javascript mailing list